added logging in ShopLogic.ReplenishManufactures

This commit is contained in:
Zakharov_Rostislav 2024-02-28 16:51:41 +04:00
parent e80baaa4fe
commit dd0195a593

View File

@ -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);