24 lines
539 B
C#
24 lines
539 B
C#
using LiteCharms.Models;
|
|
|
|
namespace LiteCharms.Features.Orders.Queries;
|
|
|
|
public class GetOrdersQuery : IRequest<Result<Order[]>>
|
|
{
|
|
public DateOnly From { get; set; }
|
|
|
|
public DateOnly To { get; set; }
|
|
|
|
private GetOrdersQuery(DateOnly from, DateOnly to)
|
|
{
|
|
From = from;
|
|
To = to;
|
|
}
|
|
|
|
public static GetOrdersQuery Create(DateOnly from, DateOnly to)
|
|
{
|
|
if (from > to)
|
|
throw new ArgumentException("From date cannot be greater than To date.");
|
|
|
|
return new(from, to);
|
|
}
|
|
} |