diff --git a/DigitalData.UserManager.Domain/Entities/UserRep.cs b/DigitalData.UserManager.Domain/Entities/UserRep.cs index f4c8293..0100e26 100644 --- a/DigitalData.UserManager.Domain/Entities/UserRep.cs +++ b/DigitalData.UserManager.Domain/Entities/UserRep.cs @@ -1,6 +1,5 @@ using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations; -using System.ComponentModel; namespace DigitalData.UserManager.Domain.Entities { diff --git a/DigitalData.UserManager.Infrastructure/Contracts/IUserRepRepository.cs b/DigitalData.UserManager.Infrastructure/Contracts/IUserRepRepository.cs index bfb3307..17e7e77 100644 --- a/DigitalData.UserManager.Infrastructure/Contracts/IUserRepRepository.cs +++ b/DigitalData.UserManager.Infrastructure/Contracts/IUserRepRepository.cs @@ -5,6 +5,8 @@ namespace DigitalData.UserManager.Infrastructure.Contracts { public interface IUserRepRepository : ICRUDRepository { - Task> ReadAllAsync(bool withUser = false, bool withRepGroup = false, bool withGroup = false, bool withRepUser = false, int? userId = null, int? groupId = null, bool readOnly = true); + Task> ReadAllAsync( + bool withUser = false, bool withRepGroup = false, bool withGroup = false, bool withRepUser = false, + int? userId = null, int? groupId = null, int? repGroupId = null, bool readOnly = true); } } \ No newline at end of file diff --git a/DigitalData.UserManager.Infrastructure/Repositories/UserRepRepository.cs b/DigitalData.UserManager.Infrastructure/Repositories/UserRepRepository.cs index 782b6c8..6ccdbe9 100644 --- a/DigitalData.UserManager.Infrastructure/Repositories/UserRepRepository.cs +++ b/DigitalData.UserManager.Infrastructure/Repositories/UserRepRepository.cs @@ -12,7 +12,9 @@ namespace DigitalData.UserManager.Infrastructure.Repositories { } - public async Task> ReadAllAsync(bool withUser = false, bool withRepGroup = false, bool withGroup = false, bool withRepUser = false, int? userId = null, int? groupId = null, bool readOnly = true) + public async Task> ReadAllAsync( + bool withUser = false, bool withRepGroup = false, bool withGroup = false, bool withRepUser = false, + int? userId = null, int? groupId = null, int? repGroupId = null, bool readOnly = true) { var query = readOnly ? _dbSet.AsNoTracking() : _dbSet.AsQueryable(); @@ -29,14 +31,13 @@ namespace DigitalData.UserManager.Infrastructure.Repositories query = query.Include(ur => ur.RepUser); if(userId is not null) - { query = query.Where(ur => ur.UserId == userId); - } if (groupId is not null) - { query = query.Where(ur => ur.GroupId == groupId); - } + + if (repGroupId is not null) + query = query.Where(ur => ur.RepGroupId == repGroupId); return await query.ToListAsync(); }