From cbdc5e691bb8cd0c3d9af968742d7c83b180168f Mon Sep 17 00:00:00 2001 From: DeerElk Date: Sun, 5 May 2024 05:50:26 +0400 Subject: [PATCH] lab5 alpha3 --- .../Implements/OrderStorage.cs | 29 ++++++++-------- .../Implements/OrderStorage.cs | 33 +++++++++---------- 2 files changed, 28 insertions(+), 34 deletions(-) diff --git a/Confectionery/ConfectioneryFileImplement/Implements/OrderStorage.cs b/Confectionery/ConfectioneryFileImplement/Implements/OrderStorage.cs index 7ad967c..170f477 100644 --- a/Confectionery/ConfectioneryFileImplement/Implements/OrderStorage.cs +++ b/Confectionery/ConfectioneryFileImplement/Implements/OrderStorage.cs @@ -18,22 +18,19 @@ namespace ConfectioneryFileImplement.Implements .Select(x => AccessPastryStorage(x.GetViewModel)) .ToList(); } - public List GetFilteredList(OrderSearchModel model) - { - return source.Orders - .Where(x => ( - (!model.Id.HasValue || x.Id == model.Id) && - (!model.DateFrom.HasValue || x.DateCreate >= - model.DateFrom) && (!model.DateTo.HasValue || - x.DateCreate <= model.DateTo) && - (!model.ClientId.HasValue || - x.ClientId == model.ClientId) - ) - ) - .Select(x => AccessPastryStorage(x.GetViewModel)) - .ToList(); - } - public OrderViewModel? GetElement(OrderSearchModel model) + public List GetFilteredList(OrderSearchModel model) + { + return source.Orders + .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 => AccessPastryStorage(x.GetViewModel)) + .ToList(); + } + public OrderViewModel? GetElement(OrderSearchModel model) { if (!model.Id.HasValue) { diff --git a/Confectionery/ConfectioneryListImplement/Implements/OrderStorage.cs b/Confectionery/ConfectioneryListImplement/Implements/OrderStorage.cs index 8ad0299..8defa2b 100644 --- a/Confectionery/ConfectioneryListImplement/Implements/OrderStorage.cs +++ b/Confectionery/ConfectioneryListImplement/Implements/OrderStorage.cs @@ -21,24 +21,21 @@ namespace ConfectioneryListImplement.Implements } return result; } - public List GetFilteredList(OrderSearchModel model) - { - var result = new List(); - foreach (var order in _source.Orders) - { - if ((!model.Id.HasValue || order.Id == model.Id) && - (!model.DateFrom.HasValue || order.DateCreate >= - model.DateFrom) && (!model.DateTo.HasValue || - order.DateCreate <= model.DateTo) && - (!model.ClientId.HasValue || - order.ClientId == model.ClientId)) - { - result.Add(AccessPastryStorage(order.GetViewModel)); - } - } - return result; - } - public OrderViewModel? GetElement(OrderSearchModel model) + public List GetFilteredList(OrderSearchModel model) + { + var result = new List(); + foreach (var order in _source.Orders) + { + if ((!model.Id.HasValue || order.Id == model.Id) && + (!model.DateFrom.HasValue || order.DateCreate >= model.DateFrom) && + (!model.DateTo.HasValue || order.DateCreate <= model.DateTo)) + { + result.Add(AccessPastryStorage(order.GetViewModel)); + } + } + return result; + } + public OrderViewModel? GetElement(OrderSearchModel model) { if (!model.Id.HasValue) {