ISEbd-21 Melnikov I. O. Lab work 01 Base #1

Closed
Igor-Melnikov wants to merge 13 commits from lab1 into main
2 changed files with 20 additions and 9 deletions
Showing only changes of commit 46c1d78dd9 - Show all commits

View File

@ -32,7 +32,7 @@ namespace BlacksmithWorkShopBusinessLogic.BusinessLogics
public bool CreateOrder(OrderBindingModel model)
{
CheckModel(model);
if ((int)model.Status > -2)
if (model.Status == OrderStatus.Неизвестен)
{
model.Status = OrderStatus.Принят;
}
@ -46,14 +46,16 @@ namespace BlacksmithWorkShopBusinessLogic.BusinessLogics
_logger.LogWarning("Create order operation failed");
return false;
}
model.Status = OrderStatus.Принят;
return true;
}
public bool TakeOrderInWork(OrderBindingModel model)
{
OrderViewModel? vm = _orderStorage.GetElement(new() { Id = model.Id });
OrderViewModel? vm = _orderStorage.GetElement(new()
{
Id = model.Id
});
model.Status = vm?.Status ?? OrderStatus.Неизвестен;
if ((int)model.Status > -1)
if (model.Status == OrderStatus.Принят)
{
model.Status = OrderStatus.Выполняется;
}
@ -69,9 +71,12 @@ namespace BlacksmithWorkShopBusinessLogic.BusinessLogics
}
public bool FinishOrder(OrderBindingModel model)
{
OrderViewModel? vm = _orderStorage.GetElement(new() { Id = model.Id });
OrderViewModel? vm = _orderStorage.GetElement(new()
{
Id = model.Id
});
model.Status = vm?.Status ?? OrderStatus.Неизвестен;
if ((int)model.Status > 0)
if (model.Status == OrderStatus.Выполняется)
{
model.Status = OrderStatus.Готов;
model.DateImplement = DateTime.Now;
@ -88,9 +93,12 @@ namespace BlacksmithWorkShopBusinessLogic.BusinessLogics
}
public bool DeliveryOrder(OrderBindingModel model)
{
OrderViewModel? vm = _orderStorage.GetElement(new() { Id = model.Id });
OrderViewModel? vm = _orderStorage.GetElement(new()
{
Id = model.Id
});
model.Status = vm?.Status ?? OrderStatus.Неизвестен;
if ((int)model.Status > 1)
if (model.Status == OrderStatus.Готов)
{
model.Status = OrderStatus.Выдан;
}

View File

@ -52,7 +52,10 @@ namespace BlacksmithWorkshopListImplement.Models
return;
}
Status = model.Status;
DateImplement = model.DateImplement;
if (model.DateImplement != null)
{
DateImplement = model.DateImplement;
}
}
public OrderViewModel GetViewModel => new()
{