Больше не возвращается статус заказа
This commit is contained in:
parent
b99e86a23d
commit
2a1749d8e8
@ -41,9 +41,9 @@ namespace ConfectioneryBusinessLogic.BusinessLogics
|
||||
return true;
|
||||
}
|
||||
|
||||
public OrderStatus? TakeOrderInWork(OrderBindingModel model) => SetOrderStatus(model, OrderStatus.Выполняется);
|
||||
public OrderStatus? DeliveryOrder(OrderBindingModel model) => SetOrderStatus(model, OrderStatus.Выдан);
|
||||
public OrderStatus? FinishOrder(OrderBindingModel model)
|
||||
public bool TakeOrderInWork(OrderBindingModel model) => SetOrderStatus(model, OrderStatus.Выполняется);
|
||||
public bool DeliveryOrder(OrderBindingModel model) => SetOrderStatus(model, OrderStatus.Выдан);
|
||||
public bool FinishOrder(OrderBindingModel model)
|
||||
{
|
||||
model.DateImplement = DateTime.Now;
|
||||
return SetOrderStatus(model, OrderStatus.Готов);
|
||||
@ -84,7 +84,7 @@ namespace ConfectioneryBusinessLogic.BusinessLogics
|
||||
return true;
|
||||
}
|
||||
|
||||
private OrderStatus? SetOrderStatus(OrderBindingModel model, OrderStatus orderStatus)
|
||||
private bool SetOrderStatus(OrderBindingModel model, OrderStatus orderStatus)
|
||||
{
|
||||
// Находим статус заказа по его айди
|
||||
var vmodel = _orderStorage.GetElement(new() { Id = model.Id });
|
||||
@ -125,9 +125,9 @@ namespace ConfectioneryBusinessLogic.BusinessLogics
|
||||
if (_orderStorage.Update(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Update operation failed");
|
||||
return null;
|
||||
return false;
|
||||
}
|
||||
return orderStatus;
|
||||
return true;
|
||||
}
|
||||
|
||||
public OrderViewModel? ReadElement(OrderSearchModel model)
|
||||
|
@ -87,8 +87,8 @@ namespace ConfectioneryView
|
||||
_logger.LogInformation("Заказ No{id}. Меняется статус на 'В работе'", id);
|
||||
try
|
||||
{
|
||||
var operationResult = _orderLogic.TakeOrderInWork(new OrderBindingModel { Id = id }) ;
|
||||
if (operationResult == null)
|
||||
var operationResult = _orderLogic.TakeOrderInWork(new OrderBindingModel { Id = id });
|
||||
if (!operationResult)
|
||||
{
|
||||
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
||||
}
|
||||
@ -116,7 +116,7 @@ namespace ConfectioneryView
|
||||
Id = id,
|
||||
Status = orderStatus
|
||||
});
|
||||
if (operationResult == null)
|
||||
if (!operationResult)
|
||||
{
|
||||
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
||||
}
|
||||
@ -141,7 +141,7 @@ namespace ConfectioneryView
|
||||
var operationResult = _orderLogic.DeliveryOrder(new
|
||||
OrderBindingModel
|
||||
{ Id = id });
|
||||
if (operationResult == null)
|
||||
if (!operationResult)
|
||||
{
|
||||
throw new Exception("Ошибка при сохранении.Дополнительная информация в логах.");
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
using ConfectioneryContracts.BindingModels;
|
||||
using ConfectioneryContracts.SearchModels;
|
||||
using ConfectioneryContracts.ViewModels;
|
||||
using ConfectioneryDataModels.Enums;
|
||||
|
||||
namespace ConfectioneryContracts.BusinessLogicsContracts
|
||||
{
|
||||
@ -10,8 +9,8 @@ namespace ConfectioneryContracts.BusinessLogicsContracts
|
||||
List<OrderViewModel>? ReadList(OrderSearchModel? model);
|
||||
OrderViewModel? ReadElement(OrderSearchModel model);
|
||||
bool CreateOrder(OrderBindingModel model);
|
||||
OrderStatus? TakeOrderInWork(OrderBindingModel model);
|
||||
OrderStatus? FinishOrder(OrderBindingModel model);
|
||||
OrderStatus? DeliveryOrder(OrderBindingModel model);
|
||||
bool TakeOrderInWork(OrderBindingModel model);
|
||||
bool FinishOrder(OrderBindingModel model);
|
||||
bool DeliveryOrder(OrderBindingModel model);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user