From 480dcce0512233614bd0d5b50726b49ead40fe73 Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Wed, 23 Oct 2024 13:19:31 +0200 Subject: [PATCH] =?UTF-8?q?feat(repository):=20=C3=9Cberladung=20der=20Rea?= =?UTF-8?q?dAsync-Methode=20mit=20Username-=20und=20usrId-Filter=20in=20Pr?= =?UTF-8?q?ofileControlsTFRepository=20hinzugef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Ü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. --- .../Contracts/IProfileControlsTFRepository.cs | 2 ++ .../Repositories/ProfileControlsTFRepository.cs | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/WorkFlow.Infrastructure/Contracts/IProfileControlsTFRepository.cs b/WorkFlow.Infrastructure/Contracts/IProfileControlsTFRepository.cs index 9a8a4c0..4bace08 100644 --- a/WorkFlow.Infrastructure/Contracts/IProfileControlsTFRepository.cs +++ b/WorkFlow.Infrastructure/Contracts/IProfileControlsTFRepository.cs @@ -6,5 +6,7 @@ namespace WorkFlow.Infrastructure.Contracts public interface IProfileControlsTFRepository : ICRUDRepository { Task> ReadAsync(bool withProfile = true, bool withUser = false, int? profileId = null, int? objId = null, bool? profileActive = null); + + Task ReadAsync(bool withProfile = true, bool withUser = false, int? usrId = null, string? username = null, int? profileId = null, int? objId = null, bool? profileActive = null); } } \ No newline at end of file diff --git a/WorkFlow.Infrastructure/Repositories/ProfileControlsTFRepository.cs b/WorkFlow.Infrastructure/Repositories/ProfileControlsTFRepository.cs index 23801cb..2e63f89 100644 --- a/WorkFlow.Infrastructure/Repositories/ProfileControlsTFRepository.cs +++ b/WorkFlow.Infrastructure/Repositories/ProfileControlsTFRepository.cs @@ -36,7 +36,11 @@ namespace WorkFlow.Infrastructure.Repositories return query; } - public async Task> ReadAsync(bool withProfile = true, bool withUser = false, int? profileId = null, int? objId = null, bool? profileActive = null) + public async Task> 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(); + + public async Task 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(); } } \ No newline at end of file