работает хоть не очень красиво

This commit is contained in:
dasha 2023-04-22 14:37:55 +04:00
parent c83a68d282
commit a410427c9b
2 changed files with 19 additions and 4 deletions

View File

@ -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
{

View File

@ -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);