From a528263511b4511626c5e295c742db446f9b4578 Mon Sep 17 00:00:00 2001 From: Salikh Date: Wed, 3 Apr 2024 15:50:05 +0400 Subject: [PATCH] commit --- .../MotorPlantFileImplement/Implements/OrderStorage.cs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/MotorPlant/MotorPlantFileImplement/Implements/OrderStorage.cs b/MotorPlant/MotorPlantFileImplement/Implements/OrderStorage.cs index 3bb7e5b..d79a83b 100644 --- a/MotorPlant/MotorPlantFileImplement/Implements/OrderStorage.cs +++ b/MotorPlant/MotorPlantFileImplement/Implements/OrderStorage.cs @@ -83,14 +83,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; } }