FIX
This commit is contained in:
parent
9399daba9e
commit
beffbdab69
@ -46,14 +46,7 @@ namespace SushiBarBusinessLogic.BusinessLogics
|
||||
|
||||
public bool FinishOrder(OrderBindingModel model)
|
||||
{
|
||||
CheckModel(model, false);
|
||||
_logger.LogInformation("Delete. Id:{Id}", model.Id);
|
||||
if (_orderStorage.Delete(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Delete operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return UpdateStatus(model, OrderStatus.Issued);
|
||||
}
|
||||
|
||||
public List<OrderViewModel>? ReadList(OrderSearchModel? model)
|
||||
@ -77,13 +70,17 @@ namespace SushiBarBusinessLogic.BusinessLogics
|
||||
private bool UpdateStatus(OrderBindingModel model, OrderStatus status)
|
||||
{
|
||||
CheckModel(model);
|
||||
|
||||
var order = _orderStorage.GetElement(new OrderSearchModel() { Id = model.Id });
|
||||
|
||||
if (model.Status + 1 != status)
|
||||
{
|
||||
_logger.LogWarning("Status update operation failed");
|
||||
return false;
|
||||
}
|
||||
model.Status = status;
|
||||
if (model.Status == OrderStatus.Issued)
|
||||
model.DateImplement = order?.DateImplement;
|
||||
if (model.Status == OrderStatus.Ready)
|
||||
{
|
||||
model.DateImplement = DateTime.Now;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user