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 {