diff --git a/Pizzeria/PizzeriaListImplement/Implements/OrderStorage.cs b/Pizzeria/PizzeriaListImplement/Implements/OrderStorage.cs index 2e033c4..6444065 100644 --- a/Pizzeria/PizzeriaListImplement/Implements/OrderStorage.cs +++ b/Pizzeria/PizzeriaListImplement/Implements/OrderStorage.cs @@ -39,7 +39,11 @@ namespace PizzeriaListImplement.Implements foreach (var order in _source.Orders) { - if (model.Id.HasValue && order.Id == model.Id) + if ( + (!model.Id.HasValue || order.Id == model.Id) && + (!model.DateFrom.HasValue || order.DateCreate >= model.DateFrom) && + (!model.DateTo.HasValue || order.DateCreate <= model.DateTo) + ) { OrderViewModel viewModel = order.GetViewModel; viewModel.PizzaName = _pizzaStorage.GetElement(new PizzaSearchModel { Id = order.PizzaId }).PizzaName; diff --git a/Pizzeria/PizzeriaShopFileImplement/Implements/OrderStorage.cs b/Pizzeria/PizzeriaShopFileImplement/Implements/OrderStorage.cs index 9c695a3..92895f0 100644 --- a/Pizzeria/PizzeriaShopFileImplement/Implements/OrderStorage.cs +++ b/Pizzeria/PizzeriaShopFileImplement/Implements/OrderStorage.cs @@ -23,7 +23,10 @@ namespace PizzeriaFileImplement.Implements public List GetFilteredList(OrderSearchModel model) { return source.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(); }