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