From 4782337fca47a55385f52848451367d4a20195fb Mon Sep 17 00:00:00 2001 From: "a.puchkina" Date: Tue, 26 Mar 2024 18:17:20 +0400 Subject: [PATCH] =?UTF-8?q?=D1=81=D0=BD=D0=BE=D0=B2=D0=B0=20=D0=B3=D0=BE?= =?UTF-8?q?=D1=82=D0=BE=D0=B2=D0=B0=D1=8F=202=20=D0=BB=D0=B0=D0=B1=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Implements/OrderStorage.cs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/TravelCompany/TracelCompanyFileImplement/Implements/OrderStorage.cs b/TravelCompany/TracelCompanyFileImplement/Implements/OrderStorage.cs index 2ecb135..a6ed4b8 100644 --- a/TravelCompany/TracelCompanyFileImplement/Implements/OrderStorage.cs +++ b/TravelCompany/TracelCompanyFileImplement/Implements/OrderStorage.cs @@ -82,14 +82,8 @@ namespace TravelCompanyFileImplement.Implements private OrderViewModel GetViewModel(Order order) { var viewModel = order.GetViewModel; - foreach (var comp in source.Travels) - { - if (comp.Id == order.TravelId) - { - viewModel.TravelName = comp.TravelName; - break; - } - } + var travel = source.Travels.FirstOrDefault(x => x.Id == order.TravelId); + viewModel.TravelName = travel?.TravelName; return viewModel; } }