Доделана логика заказов
This commit is contained in:
parent
fa639ce8b4
commit
2093186453
@ -57,16 +57,61 @@ namespace FlowerShopBusinessLogic.BusinessLogics
|
|||||||
|
|
||||||
public bool TakeOrderInWork(OrderBindingModel model)
|
public bool TakeOrderInWork(OrderBindingModel model)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
CheckModel(model, false);
|
||||||
|
|
||||||
|
if (model.Status != OrderStatus.Accepted)
|
||||||
|
{
|
||||||
|
_logger.LogWarning("Invalid order status");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
model.Status = OrderStatus.Processing;
|
||||||
|
|
||||||
|
if (_orderStorage.Insert(model) == null)
|
||||||
|
{
|
||||||
|
_logger.LogWarning("Insert operation failed");
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
public bool FinishOrder(OrderBindingModel model)
|
public bool FinishOrder(OrderBindingModel model)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
CheckModel(model, false);
|
||||||
|
|
||||||
|
if (model.Status != OrderStatus.Processing)
|
||||||
|
{
|
||||||
|
_logger.LogWarning("Invalid order status");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
model.Status = OrderStatus.Ready;
|
||||||
|
|
||||||
|
if (_orderStorage.Insert(model) == null)
|
||||||
|
{
|
||||||
|
_logger.LogWarning("Insert operation failed");
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool DeliveryOrder(OrderBindingModel model)
|
public bool DeliveryOrder(OrderBindingModel model)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
CheckModel(model, false);
|
||||||
|
|
||||||
|
if (model.Status != OrderStatus.Ready)
|
||||||
|
{
|
||||||
|
_logger.LogWarning("Invalid order status");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
model.Status = OrderStatus.Delivered;
|
||||||
|
|
||||||
|
if (_orderStorage.Insert(model) == null)
|
||||||
|
{
|
||||||
|
_logger.LogWarning("Insert operation failed");
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CheckModel(OrderBindingModel model, bool withParams = true)
|
private void CheckModel(OrderBindingModel model, bool withParams = true)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user