From b0072904691490ba0c629241ec3ac926e215bdc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=98=D0=BB=D1=8C=D1=8F=20=D0=A4=D0=B5=D0=B4=D0=BE=D1=82?= =?UTF-8?q?=D0=BE=D0=B2?= Date: Tue, 30 Apr 2024 22:48:51 +0400 Subject: [PATCH] Report fix --- .../BusinessLogic/CategoryProductLogic.cs | 2 +- .../BusinessLogic/ProductLogic.cs | 2 +- .../BusinessLogic/ReportLogic.cs | 30 ++++++++----------- .../BusinessLogic/RoleLogic.cs | 2 +- .../BusinessLogic/UserLogic.cs | 2 +- 5 files changed, 17 insertions(+), 21 deletions(-) diff --git a/ElectronicsShop/ElectronicsShopBusinessLogic/BusinessLogic/CategoryProductLogic.cs b/ElectronicsShop/ElectronicsShopBusinessLogic/BusinessLogic/CategoryProductLogic.cs index ba92476..19c6d82 100644 --- a/ElectronicsShop/ElectronicsShopBusinessLogic/BusinessLogic/CategoryProductLogic.cs +++ b/ElectronicsShop/ElectronicsShopBusinessLogic/BusinessLogic/CategoryProductLogic.cs @@ -80,7 +80,7 @@ namespace ElectronicsShopBusinessLogic.BusinessLogic { Name = model.Name }); - if (element != null && element.ID != model.ID) { + if (element != null && element.Name != model.Name) { throw new InvalidOperationException("Категория с таким названием уже есть"); } diff --git a/ElectronicsShop/ElectronicsShopBusinessLogic/BusinessLogic/ProductLogic.cs b/ElectronicsShop/ElectronicsShopBusinessLogic/BusinessLogic/ProductLogic.cs index f99298b..6c43a3f 100644 --- a/ElectronicsShop/ElectronicsShopBusinessLogic/BusinessLogic/ProductLogic.cs +++ b/ElectronicsShop/ElectronicsShopBusinessLogic/BusinessLogic/ProductLogic.cs @@ -98,7 +98,7 @@ namespace ElectronicsShopBusinessLogic.BusinessLogic _logger.LogInformation($"Product. ID:{model.ID}.ProductName:{model.ProductName}.Price:{model.Price}" + $".CategoryID:{model.CategoryID}"); var element = _storage.GetElement(new ProductSearchModel { ProductName = model.ProductName }); - if (element != null && element.ID != model.ID) { + if (element != null && element.ProductName != model.ProductName) { throw new InvalidOperationException("Продукт с таким названием уже есть"); } } diff --git a/ElectronicsShop/ElectronicsShopBusinessLogic/BusinessLogic/ReportLogic.cs b/ElectronicsShop/ElectronicsShopBusinessLogic/BusinessLogic/ReportLogic.cs index 153b274..5b1c52a 100644 --- a/ElectronicsShop/ElectronicsShopBusinessLogic/BusinessLogic/ReportLogic.cs +++ b/ElectronicsShop/ElectronicsShopBusinessLogic/BusinessLogic/ReportLogic.cs @@ -21,22 +21,18 @@ namespace ElectronicsShopBusinessLogic.BusinessLogic _productStorag = productStorag; } - public List GetOrders(ReportBindingModel model) { - throw new NotImplementedException(); - } - - // Получение списка заказов за определенный период - public List GerOrders(ReportBindingModel model) { - return _orderStorage.GetFilteredList(new OrderSearchModel { - DateFrom = model.DateFrom, - DateTo = model.DateTo, - }).Select(x => new ReportOrdersViewModel { - ID = x.ID, - DateCreate = x.DateCreate, - Sum = x.Sum, - PaymeantOption = x.PaymeantOption.ToString(), - OrderStatus = x.Status.ToString(), - }).ToList(); - } + // Получение списка заказов за определенный период + public List GetOrders(ReportBindingModel model) { + return _orderStorage.GetFilteredList(new OrderSearchModel { + DateFrom = model.DateFrom, + DateTo = model.DateTo, + }).Select(x => new ReportOrdersViewModel { + ID = x.ID, + DateCreate = x.DateCreate, + Sum = x.Sum, + PaymeantOption = x.PaymeantOption.ToString(), + OrderStatus = x.Status.ToString(), + }).ToList(); + } } } diff --git a/ElectronicsShop/ElectronicsShopBusinessLogic/BusinessLogic/RoleLogic.cs b/ElectronicsShop/ElectronicsShopBusinessLogic/BusinessLogic/RoleLogic.cs index 2c3b716..0c6b3d4 100644 --- a/ElectronicsShop/ElectronicsShopBusinessLogic/BusinessLogic/RoleLogic.cs +++ b/ElectronicsShop/ElectronicsShopBusinessLogic/BusinessLogic/RoleLogic.cs @@ -89,7 +89,7 @@ namespace ElectronicsShopBusinessLogic.BusinessLogic { Name = model.Name }); - if (element != null && element.ID != model.ID) + if (element != null && element.Name != model.Name) { throw new InvalidOperationException("Такая роль уже есть"); } diff --git a/ElectronicsShop/ElectronicsShopBusinessLogic/BusinessLogic/UserLogic.cs b/ElectronicsShop/ElectronicsShopBusinessLogic/BusinessLogic/UserLogic.cs index 70eeff3..f1289fa 100644 --- a/ElectronicsShop/ElectronicsShopBusinessLogic/BusinessLogic/UserLogic.cs +++ b/ElectronicsShop/ElectronicsShopBusinessLogic/BusinessLogic/UserLogic.cs @@ -131,7 +131,7 @@ namespace ElectronicsShopBusinessLogic.BusinessLogic { Login = model.Login }); - if (element != null && element.ID != model.ID) + if (element != null && element.Login != model.Login) { throw new InvalidOperationException("Клиент с таким логином уже есть"); }