From 530526760f72eeaf0d5f190f85eb0c78b43f3749 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 23:01:00 +0400 Subject: [PATCH 1/5] fix --- ConfectionaryListImplement/ClientStorage.cs | 11 +++++++++-- ConfectioneryDatabaseImplement/Order.cs | 1 + 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ConfectionaryListImplement/ClientStorage.cs b/ConfectionaryListImplement/ClientStorage.cs index 7540b52..7a43dca 100644 --- a/ConfectionaryListImplement/ClientStorage.cs +++ b/ConfectionaryListImplement/ClientStorage.cs @@ -66,8 +66,15 @@ namespace ConfectioneryListImplement public ClientViewModel? Insert(ClientBindingModel model) { - model.Id = _source.Clients.Count > 0 ? _source.Clients.Max(x => x.Id) + 1 : 1; - var res = Client.Create(model); + model.Id = 1; + foreach (var component in _source.Components) + { + if (model.Id <= component.Id) + { + model.Id = component.Id + 1; + } + } + var res = Client.Create(model); if (res != null) { _source.Clients.Add(res); diff --git a/ConfectioneryDatabaseImplement/Order.cs b/ConfectioneryDatabaseImplement/Order.cs index 3c815b4..080e04a 100644 --- a/ConfectioneryDatabaseImplement/Order.cs +++ b/ConfectioneryDatabaseImplement/Order.cs @@ -84,6 +84,7 @@ namespace ConfectioneryDatabaseImplement.Models return new() { PastryName = context.Pastries.FirstOrDefault(x => x.Id == PastryId)?.PastryName ?? string.Empty, + ClientId = ClientId, ClientFIO = Client?.ClientFIO ?? string.Empty, PastryId = PastryId, Count = Count, From f806775b7b948d149b60514dd1f1853ee299b782 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 23:11:36 +0400 Subject: [PATCH 2/5] =?UTF-8?q?=D0=AF=20=D0=94=D0=90=D0=A3=D0=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ConfectionaryListImplement/ClientStorage.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ConfectionaryListImplement/ClientStorage.cs b/ConfectionaryListImplement/ClientStorage.cs index 7a43dca..52497c0 100644 --- a/ConfectionaryListImplement/ClientStorage.cs +++ b/ConfectionaryListImplement/ClientStorage.cs @@ -67,11 +67,11 @@ namespace ConfectioneryListImplement public ClientViewModel? Insert(ClientBindingModel model) { model.Id = 1; - foreach (var component in _source.Components) + foreach (var client in _source.Components) { - if (model.Id <= component.Id) + if (model.Id <= client.Id) { - model.Id = component.Id + 1; + model.Id = client.Id + 1; } } var res = Client.Create(model); From c77c0dfae6c890756a4caa6a006a7eae37637a37 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 23:12:24 +0400 Subject: [PATCH 3/5] =?UTF-8?q?=D0=AF=20=D0=94=D0=90=D0=A3=D0=9D^2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ConfectionaryListImplement/ClientStorage.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ConfectionaryListImplement/ClientStorage.cs b/ConfectionaryListImplement/ClientStorage.cs index 52497c0..7a609c9 100644 --- a/ConfectionaryListImplement/ClientStorage.cs +++ b/ConfectionaryListImplement/ClientStorage.cs @@ -67,7 +67,7 @@ namespace ConfectioneryListImplement public ClientViewModel? Insert(ClientBindingModel model) { model.Id = 1; - foreach (var client in _source.Components) + foreach (var client in _source.Clients) { if (model.Id <= client.Id) { From 2a4d859356c760fcb2b00a13db61b09219a78105 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 23:26:13 +0400 Subject: [PATCH 4/5] =?UTF-8?q?=D0=BD=D0=B5=D0=BD=D0=B0=D0=B2=D0=B8=D0=B6?= =?UTF-8?q?=D1=83=20linq?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ConfectionaryListImplement/ImplementerStorage.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ConfectionaryListImplement/ImplementerStorage.cs b/ConfectionaryListImplement/ImplementerStorage.cs index 7dbf4ab..12fb158 100644 --- a/ConfectionaryListImplement/ImplementerStorage.cs +++ b/ConfectionaryListImplement/ImplementerStorage.cs @@ -82,7 +82,14 @@ namespace ConfectioneryListImplement public ImplementerViewModel? Insert(ImplementerBindingModel model) { - model.Id = _source.Implementers.Count > 0 ? _source.Implementers.Max(x => x.Id) + 1 : 1; + model.Id = 1; + foreach (var implementer in _source.Implementers) + { + if (model.Id <= implementer.Id) + { + model.Id = implementer.Id + 1; + } + } var res = Implementer.Create(model); if (res != null) { From 805b93eec9c3db9c45bda9b76dc68b92b6bd0e05 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 23:27:15 +0400 Subject: [PATCH 5/5] =?UTF-8?q?=D0=BD=D0=B0=20=D0=B2=D1=81=D1=8F=D0=BA?= =?UTF-8?q?=D0=B8=D0=B9=20=D1=81=D0=BB=D1=83=D1=87=D0=B0=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ConfectioneryDatabaseImplement/Order.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/ConfectioneryDatabaseImplement/Order.cs b/ConfectioneryDatabaseImplement/Order.cs index f50af00..88d3fa1 100644 --- a/ConfectioneryDatabaseImplement/Order.cs +++ b/ConfectioneryDatabaseImplement/Order.cs @@ -91,6 +91,7 @@ namespace ConfectioneryDatabaseImplement.Models PastryName = context.Pastries.FirstOrDefault(x => x.Id == PastryId)?.PastryName ?? string.Empty, ClientId = ClientId, ClientFIO = Client?.ClientFIO ?? string.Empty, + ImplementerId = ImplementerId, ImplementerFIO = Implementer?.ImplementerFIO ?? string.Empty, PastryId = PastryId, Count = Count,