From a157403c04978fdf359aa0c1406f84b339e44d97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=B0=D0=BD=D0=B8=D1=8F=D1=80=20=D0=90=D0=B3=D0=BB?= =?UTF-8?q?=D0=B8=D1=83=D0=BB=D0=BB=D0=BE=D0=B2?= Date: Mon, 13 Mar 2023 17:23:49 +0400 Subject: [PATCH] =?UTF-8?q?=D1=83=D0=B4=D0=B0=D0=BB=D0=B5=D0=BD=20LINQ=20?= =?UTF-8?q?=D0=BC=D0=B5=D1=82=D0=BE=D0=B4=20=D0=BF=D0=BE=D0=BB=D1=83=D1=87?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D1=8F=20=D1=84=D0=B8=D0=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ConfectionaryListImplement/ClientStorage.cs | 6 ------ ConfectionaryListImplement/Order.cs | 1 - ConfectionaryListImplement/OrderStorage.cs | 8 ++++++++ 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/ConfectionaryListImplement/ClientStorage.cs b/ConfectionaryListImplement/ClientStorage.cs index 0d441ec..7540b52 100644 --- a/ConfectionaryListImplement/ClientStorage.cs +++ b/ConfectionaryListImplement/ClientStorage.cs @@ -2,12 +2,6 @@ using ConfectioneryContracts.SearchModels; using ConfectioneryContracts.StoragesContract; using ConfectioneryContracts.ViewModels; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Security.Cryptography.X509Certificates; -using System.Text; -using System.Threading.Tasks; namespace ConfectioneryListImplement { diff --git a/ConfectionaryListImplement/Order.cs b/ConfectionaryListImplement/Order.cs index 9954ae8..d6bfc12 100644 --- a/ConfectionaryListImplement/Order.cs +++ b/ConfectionaryListImplement/Order.cs @@ -58,7 +58,6 @@ namespace ConfectioneryListImplement.Models public OrderViewModel GetViewModel => new() { PastryId = PastryId, - ClientFIO = DataListSingleton.GetInstance().Clients.FirstOrDefault(x => x.Id == ClientId)?.ClientFIO ?? string.Empty, ClientId = ClientId, Count = Count, Sum = Sum, diff --git a/ConfectionaryListImplement/OrderStorage.cs b/ConfectionaryListImplement/OrderStorage.cs index 605c158..6c794aa 100644 --- a/ConfectionaryListImplement/OrderStorage.cs +++ b/ConfectionaryListImplement/OrderStorage.cs @@ -121,6 +121,14 @@ namespace ConfectioneryListImplement break; } } + foreach (var client in _source.Clients) + { + if (client.Id == res.ClientId) + { + res.ClientFIO = client.ClientFIO; + break; + } + } return res; } }