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("Клиент с таким логином уже есть"); }