diff --git a/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/BusinessLogics/OrderLogic.cs b/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/BusinessLogics/OrderLogic.cs index 039fefd..3b4e82d 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/BusinessLogics/OrderLogic.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/BusinessLogics/OrderLogic.cs @@ -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.Выдан; } diff --git a/BlacksmithWorkshop/BlacksmithWorkshopListImplement/Models/Order.cs b/BlacksmithWorkshop/BlacksmithWorkshopListImplement/Models/Order.cs index 20ea5d1..448cbd8 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopListImplement/Models/Order.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopListImplement/Models/Order.cs @@ -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() {