From d20628d88b9ac347c0b1f14914310a54f4a20007 Mon Sep 17 00:00:00 2001 From: "[USERNAME]" Date: Wed, 20 Mar 2024 22:28:23 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9F=D1=80=D0=B0=D0=B2=D0=BA=D0=B01?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MotorPlant/MotorPlantFileImplement/OrderStorage.cs | 10 ++-------- MotorPlant/MotorPlantListImplement/Order.cs | 4 ---- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/MotorPlant/MotorPlantFileImplement/OrderStorage.cs b/MotorPlant/MotorPlantFileImplement/OrderStorage.cs index 5fdd024..8aff0bf 100644 --- a/MotorPlant/MotorPlantFileImplement/OrderStorage.cs +++ b/MotorPlant/MotorPlantFileImplement/OrderStorage.cs @@ -71,14 +71,8 @@ namespace MotorPlantFileImplement.Implements private OrderViewModel GetViewModel(Order order) { var viewModel = order.GetViewModel; - foreach (var comp in source.Engines) - { - if (comp.Id == order.EngineId) - { - viewModel.EngineName = comp.EngineName; - break; - } - } + var engine = source.Engines.FirstOrDefault(x => x.Id == order.EngineId); + viewModel.EngineName = engine?.EngineName; return viewModel; } } diff --git a/MotorPlant/MotorPlantListImplement/Order.cs b/MotorPlant/MotorPlantListImplement/Order.cs index f9bc63b..176124c 100644 --- a/MotorPlant/MotorPlantListImplement/Order.cs +++ b/MotorPlant/MotorPlantListImplement/Order.cs @@ -37,11 +37,7 @@ namespace MotorPlantListImplement.Models { return; } - EngineId = model.EngineId; - Count = model.Count; - Sum = model.Sum; Status = model.Status; - DateCreate = model.DateCreate; DateImplement = model.DateImplement; } public OrderViewModel GetViewModel => new()