для красоты

This commit is contained in:
ekallin 2024-04-08 11:07:36 +03:00
parent 30b174f8a7
commit 8384d09202

View File

@ -85,7 +85,8 @@ namespace SushiBarBusinessLogic
public bool AddSushiInShop(ShopSearchModel model, ISushiModel sushi, int count)
{
if (model == null) throw new ArgumentNullException(nameof(model));
if (model == null)
throw new ArgumentNullException(nameof(model));
if(count <= 0)
throw new ArgumentException(nameof(count));
_logger.LogInformation("AddSushiInShop. ShopName:{ShopName}.Id:{ Id}", model.ShopName, model.Id);
@ -93,18 +94,18 @@ namespace SushiBarBusinessLogic
var element = _shopStorage.GetElement(model);
if (element == null)
{
_logger.LogWarning("Не добавлено");
_logger.LogWarning("Не добавлено, такого магазина нет");
return false;
}
if (element.ShopSushis.TryGetValue(sushi.Id, out var samesushi))
{
element.ShopSushis[sushi.Id] = (sushi, samesushi.Item2 + count);
_logger.LogInformation("Same sushi found by supply. Added {0} of {1} in {2} shop", count, sushi.SushiName, element.ShopName);
_logger.LogInformation("Такие суши есть, мы добавили {0} суши с названием {1} в магазин '{2}' ", count, sushi.SushiName, element.ShopName);
}
else
{
element.ShopSushis[sushi.Id] = (sushi, count);
_logger.LogInformation("New sushi added by supply. Added {0} of {1} in {2} shop", count, sushi.SushiName, element.ShopName);
_logger.LogInformation("мы добавили {0} суши с названием {1} в магазин '{2}' ", count, sushi.SushiName, element.ShopName);
}
_shopStorage.Update(new()