From e30c3bed2e40bcaed83c511717392a4b1bd02784 Mon Sep 17 00:00:00 2001 From: kamilia Date: Mon, 6 May 2024 00:33:14 +0400 Subject: [PATCH] =?UTF-8?q?=D0=B1=D0=B5=D0=B7=20=D0=BA=D0=BE=D0=BD=D1=84?= =?UTF-8?q?=D0=BB=D0=B8=D0=BA=D1=82=D0=BE=D0=B2=20=D0=BD=D0=B5=20=D0=BE?= =?UTF-8?q?=D0=B1=D0=BE=D1=88=D0=BB=D0=BE=D1=81=D1=8C,=20=D0=BA=D0=BE?= =?UTF-8?q?=D0=BB=D0=B4=D1=83=D1=8E=20=D0=B4=D0=B0=D0=BB=D1=8C=D1=88=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AbstractShopListImplement/OrderStorage.cs | 20 +------------------ .../OrderStorage.cs | 16 ++------------- 2 files changed, 3 insertions(+), 33 deletions(-) diff --git a/AircraftPlant/AbstractShopListImplement/OrderStorage.cs b/AircraftPlant/AbstractShopListImplement/OrderStorage.cs index 582dba3..9e5e859 100644 --- a/AircraftPlant/AbstractShopListImplement/OrderStorage.cs +++ b/AircraftPlant/AbstractShopListImplement/OrderStorage.cs @@ -49,7 +49,7 @@ namespace AircraftPlantListImplement.Implements public List GetFilteredList(OrderSearchModel model) { var result = new List(); - if (!model.Id.HasValue || !model.DateFrom.HasValue || !model.DateTo.HasValue || !model.ClientId.HasValue) + if (!model.Id.HasValue || !model.DateFrom.HasValue || !model.DateTo.HasValue) { return result; } @@ -66,14 +66,6 @@ namespace AircraftPlantListImplement.Implements return result; } - if (model.ClientId.HasValue && !model.Id.HasValue) - { - foreach (var order in _source.Orders) - { - result.Add(GetViewModel(order)); - } - } - foreach (var order in _source.Orders) { if (order.Id == model.Id) @@ -180,16 +172,6 @@ namespace AircraftPlantListImplement.Implements break; } } - - foreach (var client in _source.Clients) - { - if (client.Id == order.ClientId) - { - viewModel.ClientFIO = client.ClientFIO; - break; - } - } - return viewModel; } } diff --git a/AircraftPlant/AircraftPlantFileImplement/OrderStorage.cs b/AircraftPlant/AircraftPlantFileImplement/OrderStorage.cs index 28fd55a..1544e6e 100644 --- a/AircraftPlant/AircraftPlantFileImplement/OrderStorage.cs +++ b/AircraftPlant/AircraftPlantFileImplement/OrderStorage.cs @@ -24,11 +24,10 @@ namespace AircraftPlantFileImplement.Implements } public List GetFilteredList(OrderSearchModel model) { - if (!model.Id.HasValue || !model.DateFrom.HasValue || !model.DateTo.HasValue || !model.ClientId.HasValue) + if (!model.Id.HasValue || !model.DateFrom.HasValue || !model.DateTo.HasValue) { return new(); } - if (model.DateFrom.HasValue) { return _source.Orders @@ -36,15 +35,6 @@ namespace AircraftPlantFileImplement.Implements .Select(x => GetViewModel(x)) .ToList(); } - - if (model.ClientId.HasValue && !model.Id.HasValue) - { - return _source.Orders - .Where(x => x.ClientId == model.ClientId) - .Select(x => x.GetViewModel) - .ToList(); - } - return _source.Orders.Where(x => x.Id.Equals(model.Id)).Select(x => GetViewModel(x)).ToList(); } public OrderViewModel? GetElement(OrderSearchModel model) @@ -94,9 +84,7 @@ namespace AircraftPlantFileImplement.Implements { var viewModel = order.GetViewModel; var plane = _source.Planes.FirstOrDefault(x => x.Id == order.PlaneId); - viewModel.PlaneName = plane?.PlaneName ?? string.Empty; - var client = _source.Clients.FirstOrDefault(x => x.Id == order.ClientId); - viewModel.ClientFIO = client?.ClientFIO ?? string.Empty; + viewModel.PlaneName = plane?.PlaneName; return viewModel; } }