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()