From c54abfcd3dcb7507e421960cf353b55c64222239 Mon Sep 17 00:00:00 2001 From: kamilia Date: Mon, 6 May 2024 00:02:06 +0400 Subject: [PATCH 1/2] =?UTF-8?q?=D0=BA=D0=B0=D0=BA=D0=B0=D1=8F=20=D1=82?= =?UTF-8?q?=D0=BE=20=D1=81=D1=83=D0=B5=D1=82=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AircraftPlant/AircraftPlantFileImplement/OrderStorage.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/AircraftPlant/AircraftPlantFileImplement/OrderStorage.cs b/AircraftPlant/AircraftPlantFileImplement/OrderStorage.cs index ca152f7..1544e6e 100644 --- a/AircraftPlant/AircraftPlantFileImplement/OrderStorage.cs +++ b/AircraftPlant/AircraftPlantFileImplement/OrderStorage.cs @@ -24,10 +24,17 @@ namespace AircraftPlantFileImplement.Implements } public List GetFilteredList(OrderSearchModel model) { - if (!model.Id.HasValue) + if (!model.Id.HasValue || !model.DateFrom.HasValue || !model.DateTo.HasValue) { return new(); } + if (model.DateFrom.HasValue) + { + return _source.Orders + .Where(x => x.DateCreate >= model.DateFrom && x.DateCreate <= model.DateTo) + .Select(x => GetViewModel(x)) + .ToList(); + } return _source.Orders.Where(x => x.Id.Equals(model.Id)).Select(x => GetViewModel(x)).ToList(); } public OrderViewModel? GetElement(OrderSearchModel model) From af429f0d16d53d0a27a8cfcc4f4989f89095c44b Mon Sep 17 00:00:00 2001 From: kamilia Date: Mon, 6 May 2024 00:09:24 +0400 Subject: [PATCH 2/2] =?UTF-8?q?4=20=D0=BB=D0=B0=D0=B1=D1=83=20=D0=B4=D0=BE?= =?UTF-8?q?=D0=B4=D0=B5=D0=BB=D0=B0=D0=BB=D0=B0=20=D0=B2=20=D0=BC=D0=B0?= =?UTF-8?q?=D0=B5=20=D0=B0=D1=87=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AbstractShopListImplement/OrderStorage.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/AircraftPlant/AbstractShopListImplement/OrderStorage.cs b/AircraftPlant/AbstractShopListImplement/OrderStorage.cs index 2dd4cfc..9e5e859 100644 --- a/AircraftPlant/AbstractShopListImplement/OrderStorage.cs +++ b/AircraftPlant/AbstractShopListImplement/OrderStorage.cs @@ -49,11 +49,23 @@ namespace AircraftPlantListImplement.Implements public List GetFilteredList(OrderSearchModel model) { var result = new List(); - if (!model.Id.HasValue) + if (!model.Id.HasValue || !model.DateFrom.HasValue || !model.DateTo.HasValue) { return result; } + if (model.DateFrom.HasValue) + { + foreach (var order in _source.Orders) + { + if (order.DateCreate >= model.DateFrom && order.DateCreate <= model.DateTo) + { + result.Add(GetViewModel(order)); + } + } + return result; + } + foreach (var order in _source.Orders) { if (order.Id == model.Id)