From b0b92c6be33a13ae91e89e5a6193d8b9a31c4498 Mon Sep 17 00:00:00 2001 From: maxnes3 <112558334+maxnes3@users.noreply.github.com> Date: Mon, 24 Apr 2023 20:40:36 +0400 Subject: [PATCH] =?UTF-8?q?=D0=B2=D1=81=D1=91=20=D1=80=D0=B0=D0=B1=D0=BE?= =?UTF-8?q?=D1=82=D0=B0=D0=B5=D1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ComputersShopBusinessLogic/BusinessLogics/ShopLogic.cs | 3 ++- ComputersShop/ComputersShopFileImplement/Models/Shop.cs | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/ComputersShop/ComputersShopBusinessLogic/BusinessLogics/ShopLogic.cs b/ComputersShop/ComputersShopBusinessLogic/BusinessLogics/ShopLogic.cs index b33660f..1bd7990 100644 --- a/ComputersShop/ComputersShopBusinessLogic/BusinessLogics/ShopLogic.cs +++ b/ComputersShop/ComputersShopBusinessLogic/BusinessLogics/ShopLogic.cs @@ -32,7 +32,8 @@ namespace ComputersShopBusinessLogic.BusinessLogics if (quantity <= 0) { - throw new ArgumentException("Количество добавляемого изделия должно быть больше 0", nameof(quantity)); + return false; + throw new ArgumentException("Количество добавляемого изделия должно быть больше 0", nameof(quantity)); } _logger.LogInformation("AddComputerInShop. ShopName:{ShopName}.Id:{ Id}", model.ShopName, model.Id); diff --git a/ComputersShop/ComputersShopFileImplement/Models/Shop.cs b/ComputersShop/ComputersShopFileImplement/Models/Shop.cs index 29f7631..e2eb630 100644 --- a/ComputersShop/ComputersShopFileImplement/Models/Shop.cs +++ b/ComputersShop/ComputersShopFileImplement/Models/Shop.cs @@ -99,8 +99,8 @@ namespace ComputersShopFileImplement.Models new XElement("ShopAddress", ShopAddress), new XElement("DateOpening", DateOpening.ToString()), new XElement("Capacity", Capacity.ToString()), - new XElement("Сomputers", ComputersCount.Select(x => - new XElement("Сomputer", + new XElement("Computers", ComputersCount.Select(x => + new XElement("Computer", new XElement("Key", x.Key), new XElement("Value", x.Value))) .ToArray()));