From 4da35faa7a7e2f0cff38246274fca26b40b2177a Mon Sep 17 00:00:00 2001 From: "nikbel2004@outlook.com" Date: Tue, 28 May 2024 17:50:41 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9F=D1=80=D0=B0=D0=B2=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Bank/BankCashierApp/Controllers/HomeController.cs | 2 +- Bank/BankClientApp/Controllers/HomeController.cs | 7 ++++--- Bank/BankClientApp/Views/Home/CreateCard.cshtml | 6 +++--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Bank/BankCashierApp/Controllers/HomeController.cs b/Bank/BankCashierApp/Controllers/HomeController.cs index 3905432..c499a2b 100644 --- a/Bank/BankCashierApp/Controllers/HomeController.cs +++ b/Bank/BankCashierApp/Controllers/HomeController.cs @@ -257,7 +257,7 @@ namespace BankCashierApp.Controllers return Redirect("ErrorPage"); } - APICashier.PostRequest("/api/Account/Register", new AccountBindingModel + APICashier.PostRequest("/api/Account/RegisterAccount", new AccountBindingModel { CashierId = APICashier.Cashier.Id, ClientId = clientId, diff --git a/Bank/BankClientApp/Controllers/HomeController.cs b/Bank/BankClientApp/Controllers/HomeController.cs index 13c10b2..bac904d 100644 --- a/Bank/BankClientApp/Controllers/HomeController.cs +++ b/Bank/BankClientApp/Controllers/HomeController.cs @@ -8,6 +8,7 @@ using BankContracts.ViewModels.Reports; using BankContracts.ViewModels.Reports.Client; using BankDataModels.Enums; using Microsoft.AspNetCore.Mvc; +using Microsoft.IdentityModel.Tokens; using System.Diagnostics; namespace BankClientApp.Controllers @@ -189,7 +190,7 @@ namespace BankClientApp.Controllers } [HttpPost] - public IActionResult CreateCard(string accountId, string number, string cvc, DateTime period) + public IActionResult CreateCard(string accountId, string number, double balance, DateTime period) { if (APIClient.Client == null) { @@ -198,7 +199,7 @@ namespace BankClientApp.Controllers return Redirect("ErrorPage"); } - if (string.IsNullOrEmpty(accountId) || string.IsNullOrEmpty(number) || string.IsNullOrEmpty(cvc) + if (string.IsNullOrEmpty(accountId) || string.IsNullOrEmpty(number) || balance < 0 || period.Year == 0001 || period <= DateTime.Now) { APIClient.SetErrorMessage("Проверьте корректность параметров создаваемой карты"); @@ -211,8 +212,8 @@ namespace BankClientApp.Controllers Id = APIClient.Client.Id, AccountId = int.Parse(accountId), Number = number, + Balance = balance, Period = period, - StatusCard = StatusCard.Открыта }); return Redirect("~/Home/CardsList"); diff --git a/Bank/BankClientApp/Views/Home/CreateCard.cshtml b/Bank/BankClientApp/Views/Home/CreateCard.cshtml index 881299f..794ed50 100644 --- a/Bank/BankClientApp/Views/Home/CreateCard.cshtml +++ b/Bank/BankClientApp/Views/Home/CreateCard.cshtml @@ -9,13 +9,13 @@
Номер счёта:
- +
Номер карты:
- +
@@ -49,7 +49,7 @@ return str; } - document.getElementById("cardnumber").value = createNum(16); + document.getElementById("number").value = createNum(16); let year = new Date(); year.setFullYear(year.getFullYear() + 5) document.getElementById("period").valueAsDate = new Date(year);