Правки

This commit is contained in:
nikbel2004@outlook.com 2024-05-28 17:50:41 +04:00
parent a0a8308343
commit 4da35faa7a
3 changed files with 8 additions and 7 deletions

View File

@ -257,7 +257,7 @@ namespace BankCashierApp.Controllers
return Redirect("ErrorPage"); return Redirect("ErrorPage");
} }
APICashier.PostRequest("/api/Account/Register", new AccountBindingModel APICashier.PostRequest("/api/Account/RegisterAccount", new AccountBindingModel
{ {
CashierId = APICashier.Cashier.Id, CashierId = APICashier.Cashier.Id,
ClientId = clientId, ClientId = clientId,

View File

@ -8,6 +8,7 @@ using BankContracts.ViewModels.Reports;
using BankContracts.ViewModels.Reports.Client; using BankContracts.ViewModels.Reports.Client;
using BankDataModels.Enums; using BankDataModels.Enums;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.IdentityModel.Tokens;
using System.Diagnostics; using System.Diagnostics;
namespace BankClientApp.Controllers namespace BankClientApp.Controllers
@ -189,7 +190,7 @@ namespace BankClientApp.Controllers
} }
[HttpPost] [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) if (APIClient.Client == null)
{ {
@ -198,7 +199,7 @@ namespace BankClientApp.Controllers
return Redirect("ErrorPage"); 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) || period.Year == 0001 || period <= DateTime.Now)
{ {
APIClient.SetErrorMessage("Проверьте корректность параметров создаваемой карты"); APIClient.SetErrorMessage("Проверьте корректность параметров создаваемой карты");
@ -211,8 +212,8 @@ namespace BankClientApp.Controllers
Id = APIClient.Client.Id, Id = APIClient.Client.Id,
AccountId = int.Parse(accountId), AccountId = int.Parse(accountId),
Number = number, Number = number,
Balance = balance,
Period = period, Period = period,
StatusCard = StatusCard.Открыта
}); });
return Redirect("~/Home/CardsList"); return Redirect("~/Home/CardsList");

View File

@ -9,13 +9,13 @@
<div class="row mb-2"> <div class="row mb-2">
<div class="col-4">Номер счёта:</div> <div class="col-4">Номер счёта:</div>
<div class="col-8"> <div class="col-8">
<select id="account" name="accountId" class="form-control" asp-items="@(new SelectList( @ViewBag.Accounts, "Id", "FullName"))"></select> <select id="account" name="accountId" class="form-control" asp-items="@(new SelectList( @ViewBag.Accounts, "Id", "AccountNumber"))"></select>
</div> </div>
</div> </div>
<div class="row mb-2"> <div class="row mb-2">
<div class="col-4">Номер карты:</div> <div class="col-4">Номер карты:</div>
<div class="col-8"> <div class="col-8">
<input type="text" id="cardnumber" class="form-control" name="cardnumber" required /> <input type="text" id="number" class="form-control" name="number" required />
</div> </div>
</div> </div>
<div class="row mb-2"> <div class="row mb-2">
@ -49,7 +49,7 @@
return str; return str;
} }
document.getElementById("cardnumber").value = createNum(16); document.getElementById("number").value = createNum(16);
let year = new Date(); let year = new Date();
year.setFullYear(year.getFullYear() + 5) year.setFullYear(year.getFullYear() + 5)
document.getElementById("period").valueAsDate = new Date(year); document.getElementById("period").valueAsDate = new Date(year);