diff --git a/SoftwareInstallation/SoftwareInstallationStoreApp/APIClient.cs b/SoftwareInstallation/SoftwareInstallationStoreApp/APIClient.cs index 2bd2819..e9129db 100644 --- a/SoftwareInstallation/SoftwareInstallationStoreApp/APIClient.cs +++ b/SoftwareInstallation/SoftwareInstallationStoreApp/APIClient.cs @@ -2,14 +2,16 @@ using Newtonsoft.Json; using System.Net.Http.Headers; using System.Text; +using SoftwareInstallationClientApp.Controllers; namespace SoftwareInstallationStoreApp { public class APIClient { private static readonly HttpClient _client = new(); - public static string Password { get; private set; } = string.Empty; - public static bool Access { get; set; } = false; + + private static string Password = string.Empty; + public static bool Access { get; private set; } public static void Connect(IConfiguration configuration) { @@ -33,6 +35,11 @@ namespace SoftwareInstallationStoreApp } } + public static void GetAccess(string password) + { + Access = Password.Equals(password); + } + public static void PostRequest(string requestUrl, T model) { var json = JsonConvert.SerializeObject(model); diff --git a/SoftwareInstallation/SoftwareInstallationStoreApp/Controllers/HomeController.cs b/SoftwareInstallation/SoftwareInstallationStoreApp/Controllers/HomeController.cs index b16bab3..0b53f3b 100644 --- a/SoftwareInstallation/SoftwareInstallationStoreApp/Controllers/HomeController.cs +++ b/SoftwareInstallation/SoftwareInstallationStoreApp/Controllers/HomeController.cs @@ -28,7 +28,7 @@ namespace SoftwareInstallationClientApp.Controllers { throw new Exception("Введите пароль"); } - APIClient.Access = password.Equals(APIClient.Password); + APIClient.GetAccess(password); if (APIClient.Access == false) { throw new Exception("Неправильный пароль");