diff --git a/Factory/FactoryDatabaseImplement/Models/Client.cs b/Factory/FactoryDatabaseImplement/Models/Client.cs index 1b37368..5d5511c 100644 --- a/Factory/FactoryDatabaseImplement/Models/Client.cs +++ b/Factory/FactoryDatabaseImplement/Models/Client.cs @@ -72,7 +72,6 @@ namespace FactoryDatabaseImplement.Models { return; } - Login = model.Login; Email = model.Email; Password = model.Password; } diff --git a/Factory/FactoryStorekeeperApp/Controllers/HomeController.cs b/Factory/FactoryStorekeeperApp/Controllers/HomeController.cs index 7678e88..bbabb9d 100644 --- a/Factory/FactoryStorekeeperApp/Controllers/HomeController.cs +++ b/Factory/FactoryStorekeeperApp/Controllers/HomeController.cs @@ -101,6 +101,53 @@ namespace FactoryStorekeeperApp.Controllers } [HttpGet] + public IActionResult Privacy() + { + if (!IsLoggedIn) + { + return Redirect("~/Home/Enter"); + } + return View(Client.client); + } + + [HttpPost] + public IActionResult Privacy(string email, string password) + { + if (!IsLoggedIn) + { + return Unauthorized(); + } + var existsClient = clientLogic.ReadElement(new ClientSearchModel + { + Id = Client.client.Id, + }); + clientLogic.Update(new ClientBindingModel + { + Id = Client.client.Id, + Login = existsClient.Login, + Password = password, + Email = email, + }); + var updatedClient = clientLogic.ReadElement(new ClientSearchModel + { + Id = Client.client.Id, + }); + Client.client = updatedClient; + return Redirect("~/Home/Index"); + } + + [HttpPost] + public IActionResult Logout() + { + if (!IsLoggedIn) + { + return Unauthorized(); + } + Client.client = null; + return Redirect("~/Home/Enter"); + } + + [HttpGet] public IActionResult Machines() { if (!IsLoggedIn) diff --git a/Factory/FactoryStorekeeperApp/Views/Home/Privacy.cshtml b/Factory/FactoryStorekeeperApp/Views/Home/Privacy.cshtml new file mode 100644 index 0000000..573ca31 --- /dev/null +++ b/Factory/FactoryStorekeeperApp/Views/Home/Privacy.cshtml @@ -0,0 +1,29 @@ +@using FactoryContracts.ViewModels +@{ + ViewData["Title"] = "Профиль"; +} +@model ClientViewModel +
+

Профиль кладовщика

+
+
+
+
Логин:
+
+
+
+
Почта:
+
+
+
+
Новый пароль:
+
+
+
+
+
+
+
+
+ +
\ No newline at end of file diff --git a/Factory/FactoryStorekeeperApp/Views/Shared/_Layout.cshtml b/Factory/FactoryStorekeeperApp/Views/Shared/_Layout.cshtml index 2dba99b..1c36b17 100644 --- a/Factory/FactoryStorekeeperApp/Views/Shared/_Layout.cshtml +++ b/Factory/FactoryStorekeeperApp/Views/Shared/_Layout.cshtml @@ -13,21 +13,30 @@