From baccac7171e3137b14c28a8ebfabb9ad1aabe28d Mon Sep 17 00:00:00 2001 From: Marselchi Date: Mon, 6 May 2024 10:28:07 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9C=D0=B8=D0=BA=D1=80=D0=BE=D1=84=D0=B8?= =?UTF-8?q?=D0=BA=D1=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Implements/ClientStorage.cs | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/Shipyard/ShipyardDataBaseImplement/Implements/ClientStorage.cs b/Shipyard/ShipyardDataBaseImplement/Implements/ClientStorage.cs index 4170062..c20ab52 100644 --- a/Shipyard/ShipyardDataBaseImplement/Implements/ClientStorage.cs +++ b/Shipyard/ShipyardDataBaseImplement/Implements/ClientStorage.cs @@ -42,23 +42,19 @@ namespace ShipyardDataBaseImplement.Implements if (model.Id.HasValue) { return context.Clients - .FirstOrDefault(x => x.Id == model.Id)? - .GetViewModel; + .FirstOrDefault(x => (x.Id == model.Id))?.GetViewModel; } - if (!string.IsNullOrEmpty(model.Email) && !string.IsNullOrEmpty(model.Password)) + else if (!string.IsNullOrEmpty(model.Email) && !string.IsNullOrEmpty(model.Password)) { return context.Clients - .FirstOrDefault(x => x.Email - .Equals(model.Email) && x.Password - .Equals(model.Password))? - .GetViewModel; + .FirstOrDefault(x => (x.Email == model.Email && x.Password == model.Password))?.GetViewModel; } - if (!string.IsNullOrEmpty(model.Email)) + else if (!string.IsNullOrEmpty(model.Email)) { return context.Clients - .FirstOrDefault(x => x.Email.Equals(model.Email))?.GetViewModel; + .FirstOrDefault(x => (x.Email == model.Email))?.GetViewModel; } - return null; + return new(); } public ClientViewModel? Insert(ClientBindingModel model)