From 87e51354ad5f486c7cb6d0a0535fbfe081719f1a 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, 6 Mar 2023 16:06:49 +0400 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=BE=20=D1=81=D0=BE=D1=85=D1=80=D0=B0=D0=BD=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=B8=D1=81=D0=BF=D0=BE=D0=BB=D0=BD=D0=B8?= =?UTF-8?q?=D1=82=D0=B5=D0=BB=D1=8F=20=D0=B2=20=D0=B1=D0=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ConfectioneryDatabaseImplement/ImplementerStorage.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ConfectioneryDatabaseImplement/ImplementerStorage.cs b/ConfectioneryDatabaseImplement/ImplementerStorage.cs index 948e231..2550b58 100644 --- a/ConfectioneryDatabaseImplement/ImplementerStorage.cs +++ b/ConfectioneryDatabaseImplement/ImplementerStorage.cs @@ -15,6 +15,7 @@ namespace ConfectioneryDatabaseImplement.Implements if (res != null) { context.Implementers.Remove(res); + context.SaveChanges(); } return res?.GetViewModel; } @@ -69,6 +70,7 @@ namespace ConfectioneryDatabaseImplement.Implements if (res != null) { context.Implementers.Add(res); + context.SaveChanges(); } return res?.GetViewModel; } @@ -77,7 +79,11 @@ namespace ConfectioneryDatabaseImplement.Implements { using var context = new ConfectioneryDatabase(); var res = context.Implementers.FirstOrDefault(x => x.Id == model.Id); - res?.Update(model); + if (res != null) + { + res.Update(model); + context.SaveChanges(); + } return res?.GetViewModel; } }