From 37c903b6c64ef5dab10e07c3dba6bf51309200ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=BA=20=D0=98=D0=B3=D0=BE=D1=80=D1=8C?= Date: Fri, 17 Feb 2023 01:19:20 +0400 Subject: [PATCH] =?UTF-8?q?=D0=B8=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=BB=D0=BE=D0=B3=D0=B8=D0=BA=D0=B8=20=D1=81?= =?UTF-8?q?=D0=BE=D0=B7=D0=B4=D0=B0=D0=BD=D0=B8=D1=8F=20=D0=B7=D0=B0=D0=BA?= =?UTF-8?q?=D0=B0=D0=B7=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BusinessLogics/OrderLogic.cs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/BusinessLogics/OrderLogic.cs b/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/BusinessLogics/OrderLogic.cs index b90dd14..e1017b4 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/BusinessLogics/OrderLogic.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/BusinessLogics/OrderLogic.cs @@ -32,13 +32,16 @@ namespace BlacksmithWorkShopBusinessLogic.BusinessLogics public bool CreateOrder(OrderBindingModel model) { CheckModel(model); - model.Status = OrderStatus.Принят; - if (_orderStorage.Insert(model) == null) + if (model.Status == OrderStatus.Неизвестен) { - _logger.LogWarning("Create order operation failed"); - return false; + model.Status = OrderStatus.Принят; + if (_orderStorage.Insert(model) != null) + { + return true; + } } - return true; + _logger.LogWarning("Create order operation failed"); + return false; } public bool TakeOrderInWork(OrderBindingModel model) { @@ -113,10 +116,6 @@ namespace BlacksmithWorkShopBusinessLogic.BusinessLogics { throw new ArgumentNullException("Стоимость заказа должна быть больше 0", nameof(model.Count)); } - if (model.Status != OrderStatus.Неизвестен) - { - throw new ArgumentException("Заказ не в статусе Неизвестен"); - } _logger.LogInformation("Order. Count: {Count}. Sum: {Sum}. Id: {Id}", model.Count, model.Sum, model.Id); var element = _orderStorage.GetElement(new OrderSearchModel {