diff --git a/Pizzeria/PizzeriaDatabaseImplement/Implements/OrderStorage.cs b/Pizzeria/PizzeriaDatabaseImplement/Implements/OrderStorage.cs index d5b4c63..54091c3 100644 --- a/Pizzeria/PizzeriaDatabaseImplement/Implements/OrderStorage.cs +++ b/Pizzeria/PizzeriaDatabaseImplement/Implements/OrderStorage.cs @@ -22,7 +22,12 @@ namespace PizzeriaDatabaseImplement.Implements { using var context = new PizzeriaDatabase(); return context.Orders - .Where(x => (model.Id.HasValue && x.Id == model.Id)) + .Where(x => ( + (!model.Id.HasValue || x.Id == model.Id) && + (!model.DateFrom.HasValue || x.DateCreate >= model.DateFrom) && + (!model.DateTo.HasValue || x.DateCreate <= model.DateTo) + ) + ) .Select(x => x.GetViewModel) .ToList(); }