Files
components/LiteCharms.Features/Leads/Queries/GetLeadsQuery.cs
T
2026-05-05 14:36:46 +02:00

31 lines
779 B
C#

using LiteCharms.Models;
namespace LiteCharms.Features.Leads.Queries;
public class GetLeadsQuery : IRequest<Result<Lead[]>>
{
public DateOnly From { get; set; }
public DateOnly To { get; set; }
public int MaxRecords { get; set; }
private GetLeadsQuery(DateOnly from, DateOnly to, int maxRecords = 1000)
{
From = from;
To = to;
MaxRecords = maxRecords;
}
public static GetLeadsQuery Create(DateOnly from, DateOnly to, int maxRecords = 1000)
{
if (from > to)
throw new ArgumentException("From date cannot be greater than To date.");
if(maxRecords <= 0)
throw new ArgumentException("MaxRecords must be a positive integer.");
return new(from, to, maxRecords);
}
}