Polevoy S.V. LabWork01_base #1

Closed
ChipsEater wants to merge 14 commits from LabWork01_base into main
Showing only changes of commit 2093186453 - Show all commits

View File

@ -57,16 +57,61 @@ namespace FlowerShopBusinessLogic.BusinessLogics
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)
{
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)
{
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)