From 7b7a136b5cd6d2fd228c1d4defef48edd41e794b Mon Sep 17 00:00:00 2001 From: shadowik Date: Wed, 17 May 2023 15:24:20 +0400 Subject: [PATCH] CreditingFull --- .../Controllers/HomeController.cs | 31 +++++++++++++++++++ .../Views/Home/CreateCrediting.cshtml | 27 ++++++++++++++++ .../Views/Home/CreateDebiting.cshtml | 4 +-- .../Views/Home/CreditingList.cshtml | 2 +- 4 files changed, 61 insertions(+), 3 deletions(-) create mode 100644 BankYouBankrupt/BankYouBankruptClientApp/Views/Home/CreateCrediting.cshtml diff --git a/BankYouBankrupt/BankYouBankruptClientApp/Controllers/HomeController.cs b/BankYouBankrupt/BankYouBankruptClientApp/Controllers/HomeController.cs index 0129b89..bea630d 100644 --- a/BankYouBankrupt/BankYouBankruptClientApp/Controllers/HomeController.cs +++ b/BankYouBankrupt/BankYouBankruptClientApp/Controllers/HomeController.cs @@ -202,6 +202,37 @@ namespace BankYouBankruptClientApp.Controllers return View(APIClient.GetRequest>($"api/Client/getUsersCreditings?userId={APIClient.Client.Id}")); } + [HttpGet] + public IActionResult CreateCrediting() + { + if (APIClient.Client == null) + { + return Redirect("~/Home/Enter"); + } + + ViewBag.Cards = APIClient.GetRequest>($"api/Card/GetUsersCardsList?id={APIClient.Client.Id}"); + return View(); + } + + [HttpPost] + public IActionResult CreateCrediting(string cardId, int sum) + { + if (APIClient.Client == null) + { + throw new Exception("Не авторизованы"); + } + + APIClient.PostRequest("api/Card/CreateCreditingOperation", new CreditingBindingModel() + { + CardId = int.Parse(cardId), + Sum = sum, + DateOpen = DateTime.Now, + Status = StatusEnum.Открыта + }); + + return Redirect("~/Home/CreditingList"); + } + #endregion } } \ No newline at end of file diff --git a/BankYouBankrupt/BankYouBankruptClientApp/Views/Home/CreateCrediting.cshtml b/BankYouBankrupt/BankYouBankruptClientApp/Views/Home/CreateCrediting.cshtml new file mode 100644 index 0000000..d67cbfd --- /dev/null +++ b/BankYouBankrupt/BankYouBankruptClientApp/Views/Home/CreateCrediting.cshtml @@ -0,0 +1,27 @@ +@{ + ViewData["Title"] = "Операция пополнения"; +} + +
+

Создание операции

+
+
+
+
Номер счета:
+
+ +
+
+
+
Cумма операции:
+
+ +
+
+
+
+
+ +
+
+
\ No newline at end of file diff --git a/BankYouBankrupt/BankYouBankruptClientApp/Views/Home/CreateDebiting.cshtml b/BankYouBankrupt/BankYouBankruptClientApp/Views/Home/CreateDebiting.cshtml index 9f14f26..d3a93f4 100644 --- a/BankYouBankrupt/BankYouBankruptClientApp/Views/Home/CreateDebiting.cshtml +++ b/BankYouBankrupt/BankYouBankruptClientApp/Views/Home/CreateDebiting.cshtml @@ -1,9 +1,9 @@ @{ - ViewData["Title"] = "Register"; + ViewData["Title"] = "Операция снятия"; }
-

Создание карты

+

Создание операции

diff --git a/BankYouBankrupt/BankYouBankruptClientApp/Views/Home/CreditingList.cshtml b/BankYouBankrupt/BankYouBankruptClientApp/Views/Home/CreditingList.cshtml index 93cc804..1ff2b7c 100644 --- a/BankYouBankrupt/BankYouBankruptClientApp/Views/Home/CreditingList.cshtml +++ b/BankYouBankrupt/BankYouBankruptClientApp/Views/Home/CreditingList.cshtml @@ -18,7 +18,7 @@ return; }

- Пополнить средства + Пополнить средства