From bf3837d300afb9cebe563bb9fc413a4bd97fd46e Mon Sep 17 00:00:00 2001 From: Programmist73 Date: Mon, 27 Mar 2023 12:56:32 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9C=D0=B5=D0=BB=D0=BA=D0=B8=D0=B5=20=D0=BF?= =?UTF-8?q?=D1=80=D0=B0=D0=B2=D0=BA=D0=B8.=20=D0=9D=D0=B5=20=D0=B2=D1=8B?= =?UTF-8?q?=D0=B2=D0=BE=D0=B4=D0=B8=D1=82=D1=81=D1=8F=20=D1=81=D0=BF=D0=B8?= =?UTF-8?q?=D1=81=D0=BE=D0=BA=20=D0=B7=D0=B0=D0=BA=D0=B0=D0=B7=D0=BE=D0=B2?= =?UTF-8?q?=20=D0=BD=D0=B0=20=D1=81=D0=B0=D0=B9=D1=82=D0=B5.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BusinessLogic/ClientLogic.cs | 4 ++-- .../Implements/OrderStorage.cs | 23 ++++++++----------- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/BusinessLogic/ClientLogic.cs b/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/BusinessLogic/ClientLogic.cs index fcd05a9..7a58bac 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/BusinessLogic/ClientLogic.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/BusinessLogic/ClientLogic.cs @@ -132,7 +132,7 @@ namespace BlacksmithWorkshopBusinessLogic.BusinessLogic //проверка на наличие почты if (string.IsNullOrEmpty(model.Email)) { - throw new ArgumentNullException("Отсутствие почты в учётной записи", nameof(model.Email)); + throw new ArgumentNullException("Отсутствие почты в учётной записи (логина)", nameof(model.Email)); } //проверка на наличие пароля @@ -153,7 +153,7 @@ namespace BlacksmithWorkshopBusinessLogic.BusinessLogic //если элемент найден и его Id не совпадает с Id переданного объекта if (element != null && element.Id != model.Id) { - throw new InvalidOperationException("Аккаунт с таким именем уже есть"); + throw new InvalidOperationException("Аккаунт с таким логином уже есть"); } } } diff --git a/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/Implements/OrderStorage.cs b/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/Implements/OrderStorage.cs index 7ee75e1..806deba 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/Implements/OrderStorage.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/Implements/OrderStorage.cs @@ -57,22 +57,17 @@ namespace BlacksmithWorkshopDatabaseImplement.Implements public List GetFilteredList(OrderSearchModel model) { - if (!model.Id.HasValue && !model.DateFrom.HasValue && !model.DateTo.HasValue) - { - return new(); - } + using var context = new BlacksmithWorkshopDatabase(); - using var context = new BlacksmithWorkshopDatabase(); - - if(!model.Id.HasValue && model.DateFrom.HasValue && model.DateTo.HasValue) + if (!model.Id.HasValue && !model.DateFrom.HasValue && !model.DateTo.HasValue) { - return context.Orders - .Include(x => x.Manufacture) - .Include(x => x.Client) - .Where(x => x.DateCreate >= model.DateFrom && x.DateCreate <= model.DateTo) - .Select(x => x.GetViewModel) - .ToList(); - } + return context.Orders + .Include(x => x.Manufacture) + .Include(x => x.Client) + .Where(x => x.DateCreate >= model.DateFrom && x.DateCreate <= model.DateTo) + .Select(x => x.GetViewModel) + .ToList(); + } else if (model.Id.HasValue) { return context.Orders