Что-то работает

This commit is contained in:
ityurner02@mail.ru 2023-04-16 23:14:54 +04:00
parent b38577fc3a
commit df2c68349c

View File

@ -49,6 +49,20 @@ namespace PlumbingRepairBusinessLogic.BusinessLogic
throw new ArgumentNullException(nameof(model));
}
OrderViewModel? order = _orderStorage.GetElement(new OrderSearchModel
{
Id = model.Id
});
if (order == null)
{
_logger.LogWarning("Status update to " + newStatus.ToString() + " operation failed. Order not found.");
return false;
}
model.Status = order.Status;
if (!model.ImplementerId.HasValue) model.ImplementerId = order.ImplementerId;
if (model.Status + 1 != newStatus)
{
_logger.LogWarning("Status update to " + newStatus.ToString() + " operation failed. Order status incorrect.");
@ -71,7 +85,6 @@ namespace PlumbingRepairBusinessLogic.BusinessLogic
if (_orderStorage.Update(model) == null)
{
model.Status--;
_logger.LogWarning("Update operation failed");
return false;
}