изменение логики создания заказа
This commit is contained in:
parent
8aa9a3b384
commit
37c903b6c6
@ -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
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user