From f3562db8c44d6849ef27f53952d683d4e6478c1f Mon Sep 17 00:00:00 2001 From: Safgerd Date: Mon, 24 Apr 2023 10:22:46 +0400 Subject: [PATCH 1/5] =?UTF-8?q?LabWork05=5FHard:=20=D0=A4=D0=B8=D0=BA?= =?UTF-8?q?=D1=81=20=D0=B0=D0=B2=D1=82=D0=BE=D1=80=D0=B8=D0=B7=D0=B0=D1=86?= =?UTF-8?q?=D0=B8=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AutomobilePlant/AutomobilePlantShopApp/APIClient.cs | 11 ++++++++++- .../Controllers/HomeController.cs | 7 +------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/AutomobilePlant/AutomobilePlantShopApp/APIClient.cs b/AutomobilePlant/AutomobilePlantShopApp/APIClient.cs index a5b43cb..bef2b89 100644 --- a/AutomobilePlant/AutomobilePlantShopApp/APIClient.cs +++ b/AutomobilePlant/AutomobilePlantShopApp/APIClient.cs @@ -7,8 +7,17 @@ namespace AutomobilePlantShopApp public static class APIClient { private static readonly HttpClient _client = new(); - public static bool isAuth { get; set; } = false; + public static bool isAuth { get; private set; } = false; public static string ConfigPassword { get; private set; } = string.Empty; + + public static bool Login(string password) + { + if (string.IsNullOrEmpty(password)) + { + throw new Exception("Введите пароль"); + } + return isAuth = password.Equals(ConfigPassword); + } public static void Connect(IConfiguration configuration) { ConfigPassword = configuration["Password"]; diff --git a/AutomobilePlant/AutomobilePlantShopApp/Controllers/HomeController.cs b/AutomobilePlant/AutomobilePlantShopApp/Controllers/HomeController.cs index 84f146e..4dae978 100644 --- a/AutomobilePlant/AutomobilePlantShopApp/Controllers/HomeController.cs +++ b/AutomobilePlant/AutomobilePlantShopApp/Controllers/HomeController.cs @@ -45,15 +45,10 @@ namespace AutomobilePlantShopApp.Controllers [HttpPost] public void Enter(string password) { - if (string.IsNullOrEmpty(password)) - { - throw new Exception("Введите пароль"); - } - if (!password.Equals(APIClient.ConfigPassword)) + if (!APIClient.Login(password)) { throw new Exception("Неверный пароль"); } - APIClient.isAuth = true; Response.Redirect("Index"); } [HttpGet] From d75699c18272c8947c4a0f94125732c97f465316 Mon Sep 17 00:00:00 2001 From: Safgerd Date: Fri, 28 Apr 2023 16:52:32 +0400 Subject: [PATCH 2/5] =?UTF-8?q?LabWork05=5FHard:=20=D0=B3=D0=B8=D1=82?= =?UTF-8?q?=D0=B8=D0=B3=D0=BD=D0=BE=D1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index ca1c7a3..6192267 100644 --- a/.gitignore +++ b/.gitignore @@ -398,3 +398,4 @@ FodyWeavers.xsd # JetBrains Rider *.sln.iml +/AutomobilePlant/ImplementationExtensions \ No newline at end of file From 4d74e6bb136fc93f43add3af9956f98db7f2dac8 Mon Sep 17 00:00:00 2001 From: Safgerd Date: Fri, 28 Apr 2023 16:55:52 +0400 Subject: [PATCH 3/5] gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index ca1c7a3..6192267 100644 --- a/.gitignore +++ b/.gitignore @@ -398,3 +398,4 @@ FodyWeavers.xsd # JetBrains Rider *.sln.iml +/AutomobilePlant/ImplementationExtensions \ No newline at end of file From dddbba87daf356b4c561409b886e626742da1308 Mon Sep 17 00:00:00 2001 From: Safgerd Date: Fri, 28 Apr 2023 16:56:34 +0400 Subject: [PATCH 4/5] =?UTF-8?q?LabWork02=5FHard:=20=D0=A4=D0=B8=D0=BA?= =?UTF-8?q?=D1=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AutomobilePlantBusinessLogic/BusinessLogics/OrderLogic.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AutomobilePlant/AutomobilePlantBusinessLogic/BusinessLogics/OrderLogic.cs b/AutomobilePlant/AutomobilePlantBusinessLogic/BusinessLogics/OrderLogic.cs index 9dddf06..55094d6 100644 --- a/AutomobilePlant/AutomobilePlantBusinessLogic/BusinessLogics/OrderLogic.cs +++ b/AutomobilePlant/AutomobilePlantBusinessLogic/BusinessLogics/OrderLogic.cs @@ -84,7 +84,7 @@ namespace AutomobilePlantBusinessLogic.BusinessLogics var car = _carStorage.GetElement(new CarSearchModel() { Id = model.CarId }); if (car == null) { - _logger.LogWarning("Status update to " + newStatus.ToString() + " operation failed. Document not found."); + _logger.LogWarning("Status update to " + newStatus.ToString() + " operation failed. Car not found."); return false; } if (CheckThenSupplyMany(car, model.Count) == false) From 05c44b91b11807e4d4876c366909cd282e5b229b Mon Sep 17 00:00:00 2001 From: Safgerd Date: Fri, 28 Apr 2023 16:57:34 +0400 Subject: [PATCH 5/5] gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index ca1c7a3..6192267 100644 --- a/.gitignore +++ b/.gitignore @@ -398,3 +398,4 @@ FodyWeavers.xsd # JetBrains Rider *.sln.iml +/AutomobilePlant/ImplementationExtensions \ No newline at end of file