From 0c1571545d69041651208c2f13a8a36d920c6f65 Mon Sep 17 00:00:00 2001 From: Programmist73 Date: Wed, 17 May 2023 19:18:50 +0400 Subject: [PATCH] CloseDebiting.cshtml --- .../Controllers/HomeController.cs | 55 +++++++++++++++++-- .../Views/Home/CloseDebiting.cshtml | 24 ++++++-- .../Views/Home/Debiting.cshtml | 2 +- .../Views/Home/Privacy.cshtml | 18 +++--- .../Controllers/AccountController.cs | 19 +++++++ 5 files changed, 97 insertions(+), 21 deletions(-) diff --git a/BankYouBankrupt/BankYouBankruptCashierApp/Controllers/HomeController.cs b/BankYouBankrupt/BankYouBankruptCashierApp/Controllers/HomeController.cs index 3b413b3..80f14ef 100644 --- a/BankYouBankrupt/BankYouBankruptCashierApp/Controllers/HomeController.cs +++ b/BankYouBankrupt/BankYouBankruptCashierApp/Controllers/HomeController.cs @@ -42,7 +42,7 @@ namespace BankYouBankruptCashierApp.Controllers //изменение данных Post-ом [HttpPost] - public void Privacy(string login, string password, string name, string surname, string patronymic, string telephone) + public void Privacy(string login, string password, string name, string surname, string patronymic, string telephone, string email) { if (APICashier.Cashier == null) { @@ -50,12 +50,13 @@ namespace BankYouBankruptCashierApp.Controllers } if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password) || string.IsNullOrEmpty(name) - || string.IsNullOrEmpty(surname) || string.IsNullOrEmpty(patronymic) || string.IsNullOrEmpty(telephone)) + || string.IsNullOrEmpty(surname) || string.IsNullOrEmpty(patronymic) + || string.IsNullOrEmpty(telephone) || string.IsNullOrEmpty(email)) { throw new Exception("Введите логин, пароль, ФИО и телефон"); } - APICashier.PostRequest("api/cashier/updatedata", new CashierBindingModel + APICashier.PostRequest("/api/Cashier/UpdateData", new CashierBindingModel { Id = APICashier.Cashier.Id, Name = name, @@ -72,6 +73,7 @@ namespace BankYouBankruptCashierApp.Controllers APICashier.Cashier.Email = login; APICashier.Cashier.Password = password; APICashier.Cashier.Telephone = telephone; + APICashier.Cashier.Email = email; Response.Redirect("Index"); } @@ -259,7 +261,7 @@ namespace BankYouBankruptCashierApp.Controllers return View(APICashier.GetRequest>($"/api/Account/FindOpenDebiting")); } - //открытие формы отчёта. Получаем и передаём список изделий во вьюху? + //открытие вьюхи одобрения заявки на зачисление [HttpGet] public IActionResult CloseCrediting() { @@ -268,7 +270,7 @@ namespace BankYouBankruptCashierApp.Controllers return View(); } - //создание отчёта Post-запросом + //одобрения заявки на зачисление Post-запросом [HttpPost] public void CloseCrediting(int creditingId) { @@ -295,7 +297,50 @@ namespace BankYouBankruptCashierApp.Controllers AccountPayeeId = APICashier.Card.AccountId }); + //очистка данных + APICashier.Crediting = null; + APICashier.Card = null; + Response.Redirect("Crediting"); } + + //открытие вьюхи одобрения заявки на снятие + [HttpGet] + public IActionResult CloseDebiting() + { + ViewBag.Debitings = APICashier.GetRequest>("/api/Account/FindOpenDebiting"); + + return View(); + } + + //одобрения заявки на снятие Post-запросом + [HttpPost] + public void CloseDebiting(int debitingId) + { + if (APICashier.Cashier == null) + { + throw new Exception("Вы как сюда попали? Суда вход только авторизованным"); + } + + if (debitingId < 0) + { + throw new Exception("Некорректный номер заявки на снятие"); + } + + //получаем необходимые данные для запроса + APICashier.Debiting = APICashier.GetRequest($"/api/Account/FindDebiting?id={debitingId}"); + + APICashier.Card = APICashier.GetRequest($"/api/Card/FindCard?id={APICashier.Debiting.CardId}"); + + APICashier.PostRequest("/api/Account/CloseDebiting", new CashWithdrawalBindingModel + { + CashierId = APICashier.Cashier.Id, + DebitingId = debitingId, + Sum = APICashier.Debiting.Sum, + AccountId = APICashier.Card.AccountId + }); + + Response.Redirect("Debiting"); + } } } \ No newline at end of file diff --git a/BankYouBankrupt/BankYouBankruptCashierApp/Views/Home/CloseDebiting.cshtml b/BankYouBankrupt/BankYouBankruptCashierApp/Views/Home/CloseDebiting.cshtml index e1dd794..4549d4a 100644 --- a/BankYouBankrupt/BankYouBankruptCashierApp/Views/Home/CloseDebiting.cshtml +++ b/BankYouBankrupt/BankYouBankruptCashierApp/Views/Home/CloseDebiting.cshtml @@ -1,5 +1,21 @@ -@* - For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860 -*@ -@{ +@{ + ViewData["Title"] = "Одобрение зачислений"; } + +
+

Снятие

+
+
+
+
Номер запроса на снятие:
+
+ +
+
+
+
+
+ +
+
+
\ No newline at end of file diff --git a/BankYouBankrupt/BankYouBankruptCashierApp/Views/Home/Debiting.cshtml b/BankYouBankrupt/BankYouBankruptCashierApp/Views/Home/Debiting.cshtml index 5a3aee5..50d0297 100644 --- a/BankYouBankrupt/BankYouBankruptCashierApp/Views/Home/Debiting.cshtml +++ b/BankYouBankrupt/BankYouBankruptCashierApp/Views/Home/Debiting.cshtml @@ -18,7 +18,7 @@ return; }

- Одобрение заявки + Одобрение заявки

diff --git a/BankYouBankrupt/BankYouBankruptCashierApp/Views/Home/Privacy.cshtml b/BankYouBankrupt/BankYouBankruptCashierApp/Views/Home/Privacy.cshtml index f6a014e..336e961 100644 --- a/BankYouBankrupt/BankYouBankruptCashierApp/Views/Home/Privacy.cshtml +++ b/BankYouBankrupt/BankYouBankruptCashierApp/Views/Home/Privacy.cshtml @@ -3,7 +3,7 @@ @model CashierViewModel @{ - ViewData["Title"] = "Privacy Policy"; + ViewData["Title"] = "Личный кабинет"; }
@@ -12,27 +12,23 @@
Логин:
-
+
Model.Email) />
Пароль:
-
+
Model.Password) />
Имя:
-
+
Model.Name) />
Фамилия:
-
+
Model.Surname) />
Отчество:
-
+
Model.Patronymic) />
Телефон:
-
-
-
-
Почта:
-
+
Model.Telephone) />
diff --git a/BankYouBankrupt/BankYouBankruptRestAPI/Controllers/AccountController.cs b/BankYouBankrupt/BankYouBankruptRestAPI/Controllers/AccountController.cs index a19c061..90987d4 100644 --- a/BankYouBankrupt/BankYouBankruptRestAPI/Controllers/AccountController.cs +++ b/BankYouBankrupt/BankYouBankruptRestAPI/Controllers/AccountController.cs @@ -223,6 +223,7 @@ namespace BankYouBankruptRestApi.Controllers } } + //поиск заявки на зачисление по id [HttpGet] public CreditingViewModel FindCrediting(int id) { @@ -239,5 +240,23 @@ namespace BankYouBankruptRestApi.Controllers throw; } } + + //поиск заявки на снятие по id + [HttpGet] + public DebitingViewModel FindDebiting(int id) + { + try + { + return _debitingLogic.ReadElement(new DebitingSearchModel + { + Id = id + }); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка входа в систему"); + throw; + } + } } }