работает хоть не очень красиво
This commit is contained in:
parent
c83a68d282
commit
a410427c9b
@ -92,7 +92,6 @@ namespace SushiBarBusinessLogic.BusinessLogics
|
||||
model.Status = newStatus;
|
||||
if (model.Status == OrderStatus.Готов || viewModel.Status == OrderStatus.Ожидание)
|
||||
{
|
||||
model.DateImplement = DateTime.Now;
|
||||
var sushi = _sushiStorage.GetElement(new() { Id = viewModel.SushiId });
|
||||
if (sushi == null)
|
||||
{
|
||||
@ -103,6 +102,10 @@ namespace SushiBarBusinessLogic.BusinessLogics
|
||||
model.Status = OrderStatus.Ожидание;
|
||||
_logger.LogWarning($"AddSushi operation failed. Shop is full.");
|
||||
}
|
||||
else
|
||||
{
|
||||
model.DateImplement = DateTime.Now;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -30,10 +30,22 @@ namespace SushiBarBusinessLogic.BusinessLogics
|
||||
_logger.LogWarning("DoWork. Implementers is null");
|
||||
return;
|
||||
}
|
||||
var orders = _orderLogic.ReadList(new OrderSearchModel { OrderStatus = OrderStatus.Принят });
|
||||
if (orders == null || orders.Count == 0)
|
||||
List<OrderViewModel>? orders = _orderLogic.ReadList(new OrderSearchModel { OrderStatus = OrderStatus.Принят });
|
||||
List<OrderViewModel>? ordersInWork = _orderLogic.ReadList(new OrderSearchModel { OrderStatus = OrderStatus.Выполняется });
|
||||
List<OrderViewModel>? ordersInWaiting = _orderLogic.ReadList(new OrderSearchModel { OrderStatus = OrderStatus.Ожидание });
|
||||
if (orders == null || ordersInWork == null || ordersInWaiting == null)
|
||||
{
|
||||
_logger.LogWarning("DoWork. Orders is null or empty");
|
||||
_logger.LogWarning("DoWork. Orders are null");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
orders.AddRange(ordersInWork);
|
||||
orders.AddRange(ordersInWaiting);
|
||||
}
|
||||
if (orders.Count == 0)
|
||||
{
|
||||
_logger.LogWarning("DoWork. Orders are empty");
|
||||
return;
|
||||
}
|
||||
_logger.LogDebug("DoWork for {Count} orders", orders.Count);
|
||||
|
Loading…
Reference in New Issue
Block a user