2020-12-20 00:18:53 +02:00
|
|
|
|
using IdentityServer.Domain.Data.DbContexts;
|
|
|
|
|
using IdentityServer.Domain.Entities;
|
|
|
|
|
using IdentityServer.Domain.Repositories;
|
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace IdentityServer.Domain.Data.Repositories
|
|
|
|
|
{
|
|
|
|
|
class IdentityRepository : IIdentityRepository
|
|
|
|
|
{
|
|
|
|
|
private readonly IdentityDbContext _dbContext;
|
|
|
|
|
|
|
|
|
|
public IdentityRepository(IdentityDbContext dbContext)
|
|
|
|
|
{
|
|
|
|
|
_dbContext = dbContext;
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-20 03:06:43 +02:00
|
|
|
|
public Task<AppUser> GetAppUser(int userId)
|
|
|
|
|
{
|
|
|
|
|
return _dbContext.AppUsers.FirstOrDefaultAsync(z => z.UserId == userId);
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-20 00:18:53 +02:00
|
|
|
|
public Task<AppUser> GetAppUser(string userName, string password)
|
|
|
|
|
{
|
|
|
|
|
return _dbContext.AppUsers.FirstOrDefaultAsync(z => z.UserName == userName && z.Password == password);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|