From dd0195a593c38ebb2a04f863ef31a1e96dce1ae5 Mon Sep 17 00:00:00 2001 From: Zakharov_Rostislav Date: Wed, 28 Feb 2024 16:51:41 +0400 Subject: [PATCH] added logging in ShopLogic.ReplenishManufactures --- .../BusinessLogics/ShopLogic.cs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/BusinessLogics/ShopLogic.cs b/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/BusinessLogics/ShopLogic.cs index 02ba054..48e1963 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/BusinessLogics/ShopLogic.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/BusinessLogics/ShopLogic.cs @@ -88,17 +88,26 @@ namespace BlacksmithWorkshopBusinessLogic.BusinessLogics { _logger.LogInformation("Try to replenish manufactures. ShopName:{ShopName}. Id:{Id}", model.ShopName, model.Id); if (model == null) - throw new ArgumentNullException(nameof(model)); + { + _logger.LogWarning("Read operation failed"); + throw new ArgumentNullException(nameof(model)); + } ShopViewModel? curModel = ReadElement(model); if (curModel == null) { _logger.LogWarning("Read operation failed"); - return false; + throw new ArgumentNullException(nameof(curModel)); } if (manufacture == null) - throw new ArgumentNullException(nameof(manufacture)); + { + _logger.LogWarning("Read operation failed"); + throw new ArgumentNullException(nameof(manufacture)); + } if (count <= 0) - throw new ArgumentException("Количество должно быть положительным числом"); + { + _logger.LogWarning("Read operation failed"); + throw new ArgumentException("Количество должно быть положительным числом"); + } if (curModel.ShopManufactures.TryGetValue(manufacture.Id, out var pair)) { curModel.ShopManufactures[manufacture.Id] = (pair.Item1, pair.Item2 + count);