Add project files
This commit is contained in:
18
T120B165-ImgBoard/Services/UserService.cs
Normal file
18
T120B165-ImgBoard/Services/UserService.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using T120B165_ImgBoard.Data;
|
||||
using T120B165_ImgBoard.Models;
|
||||
|
||||
namespace T120B165_ImgBoard.Services;
|
||||
|
||||
public interface IUserService
|
||||
{
|
||||
public Task<User?> GetUserById(string id);
|
||||
}
|
||||
|
||||
public class UserService(ImgBoardContext context): IUserService
|
||||
{
|
||||
public async Task<User?> GetUserById(string id)
|
||||
{
|
||||
return await context.Users.Where(u => u.Id == id).FirstOrDefaultAsync();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user