From eadf7da8361afe6278cf62cedee7be2a07b24411 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9F=D0=B0=D0=B2=D0=B5=D0=BB=20=D0=9F=D1=83=D1=82=D0=B8?= =?UTF-8?q?=D0=BB=D0=B8=D0=BD?= Date: Tue, 25 Apr 2023 20:24:58 +0400 Subject: [PATCH] fix --- .../PrecastConcretePlantBusinessLogic/ShopLogic.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/PrecastConcretePlant/PrecastConcretePlantBusinessLogic/ShopLogic.cs b/PrecastConcretePlant/PrecastConcretePlantBusinessLogic/ShopLogic.cs index de45dd1..86cba03 100644 --- a/PrecastConcretePlant/PrecastConcretePlantBusinessLogic/ShopLogic.cs +++ b/PrecastConcretePlant/PrecastConcretePlantBusinessLogic/ShopLogic.cs @@ -128,9 +128,14 @@ namespace PrecastConcretePlantBusinessLogic { throw new ArgumentException("Количество добавляемого изделия должно быть больше 0", nameof(count)); } + _logger.LogInformation("AddreinforcedInShop. ShopName:{ShopName}.Id:{ Id}", model.Name, model.Id); var element = _shopStorage.GetElement(model); + if (element.MaxCountReinforceds < count + element.Reinforceds.Sum(x => x.Value.Item2)) + { + throw new ArgumentException("Количество добавляемого изделия не должно быть больше максимального кол-ва изделий в магазине", nameof(count)); + } if (element == null) { _logger.LogWarning("AddreinforcedInShop element not found");