feat: ReadAsync-Methode zur ClientUserRepository mit optionalem userId-Filter hinzugefügt
This commit is contained in:
parent
978d8aaa55
commit
2a4358a7c7
@ -5,5 +5,6 @@ namespace DigitalData.UserManager.Infrastructure.Contracts
|
||||
{
|
||||
public interface IClientUserRepository : ICRUDRepository<ClientUser, int>
|
||||
{
|
||||
Task<IEnumerable<ClientUser>> ReadAsync(bool readOnly = true, int? userId = null);
|
||||
}
|
||||
}
|
||||
@ -11,5 +11,15 @@ namespace DigitalData.UserManager.Infrastructure.Repositories
|
||||
public ClientUserRepository(TDbContext dbContext) : base(dbContext, dbContext.Set<ClientUser>())
|
||||
{
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<ClientUser>> ReadAsync(bool readOnly = true, int? userId = null)
|
||||
{
|
||||
var query = readOnly ? _dbSet.AsNoTracking() : _dbSet.AsQueryable();
|
||||
|
||||
if (userId is not null)
|
||||
query = query.Where(cu => cu.UserId == userId);
|
||||
|
||||
return await query.ToListAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user