diff --git a/.gitignore b/.gitignore index ca1c7a3..4f51ab0 100644 --- a/.gitignore +++ b/.gitignore @@ -398,3 +398,4 @@ FodyWeavers.xsd # JetBrains Rider *.sln.iml +ImplementationExtensions/ \ No newline at end of file diff --git a/SecuritySystem/SecuritySystemBusinessLogic/BusinessLogics/OrderLogic.cs b/SecuritySystem/SecuritySystemBusinessLogic/BusinessLogics/OrderLogic.cs index 9de3c29..844b960 100644 --- a/SecuritySystem/SecuritySystemBusinessLogic/BusinessLogics/OrderLogic.cs +++ b/SecuritySystem/SecuritySystemBusinessLogic/BusinessLogics/OrderLogic.cs @@ -13,12 +13,14 @@ namespace SecuritySystemBusinessLogic.BusinessLogics private readonly ILogger _logger; private readonly IOrderStorage _orderStorage; private readonly IShopLogic _shopLogic; + private readonly ISecureStorage _secureStorage; - public OrderLogic(ILogger logger, IOrderStorage orderStorage, IShopLogic shopLogic) + public OrderLogic(ILogger logger, IOrderStorage orderStorage, IShopLogic shopLogic, ISecureStorage secureStorage) { _logger = logger; _orderStorage = orderStorage; _shopLogic = shopLogic; + _secureStorage = secureStorage; } public List? ReadList(OrderSearchModel? model) @@ -56,14 +58,18 @@ namespace SecuritySystemBusinessLogic.BusinessLogics _logger.LogWarning("Read operation failed"); return false; } + model.SecureId = element.SecureId; + model.Count = element.Count; + model.Sum = element.Sum; if (element.Status != targetStatus - 1) { _logger.LogWarning("Status change operation failed"); throw new InvalidOperationException("Текущий статус заказа не может быть переведен в выбранный"); } + var secure = _secureStorage.GetElement(new SecureSearchModel { Id = model.SecureId }); if (targetStatus == OrderStatus.Выдан) { - _shopLogic.SupplySecures(); + _shopLogic.SupplySecures(secure, model.Count); } model.Status = targetStatus; if (model.Status == OrderStatus.Выдан)