feat(repository): Überladung der ReadAsync-Methode mit Username- und usrId-Filter in ProfileControlsTFRepository hinzugefügt

- Überladung von `ReadAsync` hinzugefügt, um die Filterung nach `usrId` und `username` zu unterstützen.
- `ReadAsync` aktualisiert, um die Einzelabfrage mit `FirstOrDefaultAsync` zu ermöglichen.
- Abfrageflexibilität verbessert, indem Benutzer- und Profilfilter in beiden asynchronen Methoden zugelassen werden.
This commit is contained in:
Developer 02 2024-10-23 13:19:31 +02:00
parent e0877f5990
commit 480dcce051
2 changed files with 7 additions and 1 deletions

View File

@ -6,5 +6,7 @@ namespace WorkFlow.Infrastructure.Contracts
public interface IProfileControlsTFRepository : ICRUDRepository<ProfileControlsTF, int> public interface IProfileControlsTFRepository : ICRUDRepository<ProfileControlsTF, int>
{ {
Task<IEnumerable<ProfileControlsTF>> ReadAsync(bool withProfile = true, bool withUser = false, int? profileId = null, int? objId = null, bool? profileActive = null); Task<IEnumerable<ProfileControlsTF>> ReadAsync(bool withProfile = true, bool withUser = false, int? profileId = null, int? objId = null, bool? profileActive = null);
Task<ProfileControlsTF?> ReadAsync(bool withProfile = true, bool withUser = false, int? usrId = null, string? username = null, int? profileId = null, int? objId = null, bool? profileActive = null);
} }
} }

View File

@ -36,7 +36,11 @@ namespace WorkFlow.Infrastructure.Repositories
return query; return query;
} }
public async Task<IEnumerable<ProfileControlsTF>> ReadAsync(bool withProfile = true, bool withUser = false, int? profileId = null, int? objId = null, bool? profileActive = null) public async Task<IEnumerable<ProfileControlsTF>> ReadAsync(bool withProfile = true, bool withUser = true, int? profileId = null, int? objId = null, bool? profileActive = null)
=> await Read(withProfile: withProfile, withUser: withUser, profileId: profileId, objId: objId, profileActive: profileActive).ToListAsync(); => await Read(withProfile: withProfile, withUser: withUser, profileId: profileId, objId: objId, profileActive: profileActive).ToListAsync();
public async Task<ProfileControlsTF?> ReadAsync(bool withProfile = true, bool withUser = false, int? usrId = null, string? username = null, int? profileId = null, int? objId = null, bool? profileActive = null)
=> await Read(withProfile: withProfile, withUser: withUser, usrId: usrId, username: username, profileId: profileId, objId: objId, profileActive: profileActive)
.FirstOrDefaultAsync();
} }
} }