diff --git a/EnvelopeGenerator.Application/Common/Query/ReceiverQueryBase.cs b/EnvelopeGenerator.Application/Common/Query/ReceiverQueryBase.cs
index 589598a3..bfb6a26c 100644
--- a/EnvelopeGenerator.Application/Common/Query/ReceiverQueryBase.cs
+++ b/EnvelopeGenerator.Application/Common/Query/ReceiverQueryBase.cs
@@ -1,4 +1,6 @@
-namespace EnvelopeGenerator.Application.Common.Query;
+using System.ComponentModel.DataAnnotations.Schema;
+
+namespace EnvelopeGenerator.Application.Common.Query;
///
/// Stellt eine Abfrage dar, um die Details eines Empfängers zu lesen.
@@ -29,5 +31,6 @@ public record ReceiverQueryBase
/// , , or is not null.
/// Usage example: The query can be executed only if at least one criterion is specified.
///
- public bool HasAnyCriteria => Id is not null || EmailAddress is not null || Signature is not null;
+ [NotMapped]
+ public virtual bool HasAnyCriteria => Id is not null || EmailAddress is not null || Signature is not null;
}
\ No newline at end of file
diff --git a/EnvelopeGenerator.Application/Receivers/Queries/ReadReceiverQuery.cs b/EnvelopeGenerator.Application/Receivers/Queries/ReadReceiverQuery.cs
index b1255514..53d900ef 100644
--- a/EnvelopeGenerator.Application/Receivers/Queries/ReadReceiverQuery.cs
+++ b/EnvelopeGenerator.Application/Receivers/Queries/ReadReceiverQuery.cs
@@ -5,6 +5,7 @@ using EnvelopeGenerator.Application.Common.Query;
using MediatR;
using EnvelopeGenerator.Domain.Entities;
using Microsoft.EntityFrameworkCore;
+using System.ComponentModel.DataAnnotations.Schema;
namespace EnvelopeGenerator.Application.Receivers.Queries;
@@ -12,7 +13,24 @@ namespace EnvelopeGenerator.Application.Receivers.Queries;
/// Stellt eine Abfrage dar, um die Details eines Empfängers zu lesen.
/// um spezifische Informationen über einen Empfänger abzurufen.
///
-public record ReadReceiverQuery : ReceiverQueryBase, IRequest>;
+public record ReadReceiverQuery : ReceiverQueryBase, IRequest>
+{
+ ///
+ /// Suchbegriff für eine teilweise Übereinstimmung in der E-Mail Adresse des Empfängers
+ ///
+ public virtual string? EmailAddressSearch { get; set; }
+
+ ///
+ /// Checks whether any of the specified query criteria have a value.
+ ///
+ ///
+ /// This property returns true if at least one of the fields
+ /// , , , or is not null.
+ /// Usage example: The query can be executed only if at least one criterion is specified.
+ ///
+ [NotMapped]
+ public override bool HasAnyCriteria => EmailAddressSearch is not null || base.HasAnyCriteria;
+}
///
///
@@ -53,6 +71,11 @@ public class ReadReceiverQueryHandler : IRequestHandler r.EmailAddress == email);
}
+ if (!string.IsNullOrWhiteSpace(request.EmailAddressSearch))
+ {
+ query = query.Where(r => EF.Functions.Like(r.EmailAddress, $"%{request.EmailAddressSearch}%"));
+ }
+
if (request.Signature is string signature)
{
query = query.Where(r => r.Signature == signature);