From 1ea5be4788c33c9f2e9c2219207398c371deb9c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9D=D0=B8=D0=BA=D0=BE=D0=BB=D0=B0=D0=B9?= Date: Tue, 4 Apr 2023 13:29:56 +0400 Subject: [PATCH] =?UTF-8?q?=D1=84=D1=80=D0=BE=D0=BD=D1=82=20=D0=B2=D1=80?= =?UTF-8?q?=D0=BE=D0=B4=D0=B5=20=D0=B3=D0=BE=D1=82=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/HomeController.cs | 74 +++++++++++++++---- .../Controllers/WorkerController.cs | 72 ------------------ .../Views/{Worker => Home}/Builds.cshtml | 0 .../Views/{Worker => Home}/Comments.cshtml | 0 .../Views/Home/Index.cshtml | 2 +- .../{Worker => Home}/LinkPurchase.cshtml | 0 .../Views/{Worker => Home}/MainWorker.cshtml | 2 +- .../Views/{Worker => Home}/Purchase.cshtml | 0 .../Views/{Worker => Home}/Purchases.cshtml | 0 .../{Worker => Home}/WorkerReport.cshtml | 0 .../{Worker => Home}/listComponents.cshtml | 0 .../Views/Shared/_LayoutWorker.cshtml | 10 +-- 12 files changed, 66 insertions(+), 94 deletions(-) delete mode 100644 HardwareShop/HardwareShopWorkerApp/Controllers/WorkerController.cs rename HardwareShop/HardwareShopWorkerApp/Views/{Worker => Home}/Builds.cshtml (100%) rename HardwareShop/HardwareShopWorkerApp/Views/{Worker => Home}/Comments.cshtml (100%) rename HardwareShop/HardwareShopWorkerApp/Views/{Worker => Home}/LinkPurchase.cshtml (100%) rename HardwareShop/HardwareShopWorkerApp/Views/{Worker => Home}/MainWorker.cshtml (77%) rename HardwareShop/HardwareShopWorkerApp/Views/{Worker => Home}/Purchase.cshtml (100%) rename HardwareShop/HardwareShopWorkerApp/Views/{Worker => Home}/Purchases.cshtml (100%) rename HardwareShop/HardwareShopWorkerApp/Views/{Worker => Home}/WorkerReport.cshtml (100%) rename HardwareShop/HardwareShopWorkerApp/Views/{Worker => Home}/listComponents.cshtml (100%) diff --git a/HardwareShop/HardwareShopWorkerApp/Controllers/HomeController.cs b/HardwareShop/HardwareShopWorkerApp/Controllers/HomeController.cs index bdc3938..5f9f0a2 100644 --- a/HardwareShop/HardwareShopWorkerApp/Controllers/HomeController.cs +++ b/HardwareShop/HardwareShopWorkerApp/Controllers/HomeController.cs @@ -28,15 +28,7 @@ namespace HardwareShopWorkerApp.Controllers { throw new Exception("Введите логин, email, пароль и роль"); } - APIClient.PostRequest("api/client/register", new UserBindingModel - { - Login = login, - Email = email, - Password = password, - Role = (UserRole)role - }); Response.Redirect("Enter"); - return; } public IActionResult Index() @@ -61,18 +53,70 @@ namespace HardwareShopWorkerApp.Controllers } [HttpPost] - public IActionResult Enter(string email, string password) + public void Enter(string email, string password) { if (string.IsNullOrEmpty(email) || string.IsNullOrEmpty(password)) { throw new Exception("Введите почту и пароль"); } - APIClient.User = APIClient.GetRequest($"api/client/login?email={email}&password={password}"); - if (APIClient.User == null) - { - throw new Exception("Неверные почта и/или пароль"); - } - return RedirectToAction("MainWorker", "Worker"); + Response.Redirect("MainWorker"); + } + + public IActionResult MainWorker() + { + return View(); + } + + public IActionResult Comments() + { + return View(); + } + + public IActionResult listComponents() + { + return View(); + } + + [HttpGet] + public IActionResult Purchases() + { + return View(); + } + + [HttpPost] + public void Purchases(int id) + { + Response.Redirect("Purchase"); + } + + + [HttpGet] + public IActionResult Purchase() + { + return View(); + } + + public IActionResult WorkerReport() + { + return View(); + } + + [HttpGet] + public IActionResult Builds() + { + return View(); + } + + [HttpPost] + public void Builds(int id) + { + Response.Redirect("LinkPurchase"); + } + + [HttpGet] + public IActionResult LinkPurchase() + { + return View(); } } } \ No newline at end of file diff --git a/HardwareShop/HardwareShopWorkerApp/Controllers/WorkerController.cs b/HardwareShop/HardwareShopWorkerApp/Controllers/WorkerController.cs deleted file mode 100644 index 0dac16d..0000000 --- a/HardwareShop/HardwareShopWorkerApp/Controllers/WorkerController.cs +++ /dev/null @@ -1,72 +0,0 @@ -using Microsoft.AspNetCore.Mvc; - -namespace HardwareShopWorkerApp.Controllers -{ - public class WorkerController : Controller - { - private readonly ILogger _logger; - - public WorkerController(ILogger logger) - { - _logger = logger; - } - - public IActionResult Comments() - { - return View(); - } - - public IActionResult listComponents() - { - return View(); - } - - public IActionResult MainWorker() - { - return View(); - } - - [HttpGet] - public IActionResult Purchases() - { - return View(); - } - - [HttpPost] - public void Purchases(int id) - { - Response.Redirect("Purchase"); - } - - - [HttpGet] - public IActionResult Purchase() - { - return View(); - } - - public IActionResult WorkerReport() - { - return View(); - } - - [HttpGet] - public IActionResult Builds() - { - return View(); - } - - [HttpPost] - public void Builds(int id) - { - Response.Redirect("LinkPurchase"); - } - - [HttpGet] - public IActionResult LinkPurchase() - { - return View(); - } - - } -} diff --git a/HardwareShop/HardwareShopWorkerApp/Views/Worker/Builds.cshtml b/HardwareShop/HardwareShopWorkerApp/Views/Home/Builds.cshtml similarity index 100% rename from HardwareShop/HardwareShopWorkerApp/Views/Worker/Builds.cshtml rename to HardwareShop/HardwareShopWorkerApp/Views/Home/Builds.cshtml diff --git a/HardwareShop/HardwareShopWorkerApp/Views/Worker/Comments.cshtml b/HardwareShop/HardwareShopWorkerApp/Views/Home/Comments.cshtml similarity index 100% rename from HardwareShop/HardwareShopWorkerApp/Views/Worker/Comments.cshtml rename to HardwareShop/HardwareShopWorkerApp/Views/Home/Comments.cshtml diff --git a/HardwareShop/HardwareShopWorkerApp/Views/Home/Index.cshtml b/HardwareShop/HardwareShopWorkerApp/Views/Home/Index.cshtml index b909037..15693ff 100644 --- a/HardwareShop/HardwareShopWorkerApp/Views/Home/Index.cshtml +++ b/HardwareShop/HardwareShopWorkerApp/Views/Home/Index.cshtml @@ -19,7 +19,7 @@ Регистрация diff --git a/HardwareShop/HardwareShopWorkerApp/Views/Worker/LinkPurchase.cshtml b/HardwareShop/HardwareShopWorkerApp/Views/Home/LinkPurchase.cshtml similarity index 100% rename from HardwareShop/HardwareShopWorkerApp/Views/Worker/LinkPurchase.cshtml rename to HardwareShop/HardwareShopWorkerApp/Views/Home/LinkPurchase.cshtml diff --git a/HardwareShop/HardwareShopWorkerApp/Views/Worker/MainWorker.cshtml b/HardwareShop/HardwareShopWorkerApp/Views/Home/MainWorker.cshtml similarity index 77% rename from HardwareShop/HardwareShopWorkerApp/Views/Worker/MainWorker.cshtml rename to HardwareShop/HardwareShopWorkerApp/Views/Home/MainWorker.cshtml index d5b8a9e..9a15a29 100644 --- a/HardwareShop/HardwareShopWorkerApp/Views/Worker/MainWorker.cshtml +++ b/HardwareShop/HardwareShopWorkerApp/Views/Home/MainWorker.cshtml @@ -4,5 +4,5 @@ }
- +
\ No newline at end of file diff --git a/HardwareShop/HardwareShopWorkerApp/Views/Worker/Purchase.cshtml b/HardwareShop/HardwareShopWorkerApp/Views/Home/Purchase.cshtml similarity index 100% rename from HardwareShop/HardwareShopWorkerApp/Views/Worker/Purchase.cshtml rename to HardwareShop/HardwareShopWorkerApp/Views/Home/Purchase.cshtml diff --git a/HardwareShop/HardwareShopWorkerApp/Views/Worker/Purchases.cshtml b/HardwareShop/HardwareShopWorkerApp/Views/Home/Purchases.cshtml similarity index 100% rename from HardwareShop/HardwareShopWorkerApp/Views/Worker/Purchases.cshtml rename to HardwareShop/HardwareShopWorkerApp/Views/Home/Purchases.cshtml diff --git a/HardwareShop/HardwareShopWorkerApp/Views/Worker/WorkerReport.cshtml b/HardwareShop/HardwareShopWorkerApp/Views/Home/WorkerReport.cshtml similarity index 100% rename from HardwareShop/HardwareShopWorkerApp/Views/Worker/WorkerReport.cshtml rename to HardwareShop/HardwareShopWorkerApp/Views/Home/WorkerReport.cshtml diff --git a/HardwareShop/HardwareShopWorkerApp/Views/Worker/listComponents.cshtml b/HardwareShop/HardwareShopWorkerApp/Views/Home/listComponents.cshtml similarity index 100% rename from HardwareShop/HardwareShopWorkerApp/Views/Worker/listComponents.cshtml rename to HardwareShop/HardwareShopWorkerApp/Views/Home/listComponents.cshtml diff --git a/HardwareShop/HardwareShopWorkerApp/Views/Shared/_LayoutWorker.cshtml b/HardwareShop/HardwareShopWorkerApp/Views/Shared/_LayoutWorker.cshtml index 50a1f46..9f0f51c 100644 --- a/HardwareShop/HardwareShopWorkerApp/Views/Shared/_LayoutWorker.cshtml +++ b/HardwareShop/HardwareShopWorkerApp/Views/Shared/_LayoutWorker.cshtml @@ -20,19 +20,19 @@