From 886cfe9f3a651aa42e05a655d739eb8f435a2fb9 Mon Sep 17 00:00:00 2001 From: Ivan_Starostin Date: Sun, 2 Jun 2024 16:41:31 +0400 Subject: [PATCH] Upload files to 'ShipyardFileImplement' --- ShipyardFileImplement/OrderStorage.cs | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/ShipyardFileImplement/OrderStorage.cs b/ShipyardFileImplement/OrderStorage.cs index 1122256..a1e2b2e 100644 --- a/ShipyardFileImplement/OrderStorage.cs +++ b/ShipyardFileImplement/OrderStorage.cs @@ -24,14 +24,16 @@ namespace ShipyardFileImplement.Implements } public List GetFilteredList(OrderSearchModel model) { - if (!model.Id.HasValue) - { - return new(); - } + return source.Orders - .Where(x => x.Id == model.Id) - .Select(x => AccessShipStorage(x.GetViewModel)) - .ToList(); + .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 => AccessShipStorage(x.GetViewModel)) + .ToList(); } public OrderViewModel? GetElement(OrderSearchModel model) { @@ -82,7 +84,14 @@ namespace ShipyardFileImplement.Implements { if (model == null) return null; - model = source.Ships.Where(x => x.Id == model.ShipId).FirstOrDefault(); + foreach (var Ship in source.Ships) + { + if (Ship.Id == model.ShipId) + { + model.ShipName = Ship.ShipName; + break; + } + } return model; } }