ISEbd-21 Melnikov I. O. Lab work 01 Base #1
@ -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.Выдан;
|
||||
}
|
||||
|
@ -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()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user