feat: Из dal перенесены все модели в Domain. Из dal переименованы service в repository, вынесены в Core.
This commit is contained in:
21
PARR.DAL/Repositories/UserRepository.cs
Normal file
21
PARR.DAL/Repositories/UserRepository.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using PARR.Core.Repositories.Interfaces;
|
||||
using PARR.DAL.Context;
|
||||
using PARR.DAL.Repositories.Base;
|
||||
using PARR.Domain.Entities;
|
||||
|
||||
namespace PARR.DAL.Repositories
|
||||
{
|
||||
internal class UserRepository : BaseRepository<User>, IUserRepository
|
||||
{
|
||||
public UserRepository(DataContext dataContext, ILogger<UserRepository> logger) : base(logger, dataContext) { }
|
||||
|
||||
public async Task<User?> GetByIpWithRolesAsync(string ipAddress)
|
||||
{
|
||||
return await EntitySet
|
||||
.Include(t => t.Roles).ThenInclude(t => t.Role)
|
||||
.FirstOrDefaultAsync(t => t.Ip == ipAddress);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user