This commit is contained in:
Programmist73 2023-05-17 19:29:45 +04:00
commit f5a129511b
8 changed files with 65 additions and 7 deletions

View File

@ -202,6 +202,37 @@ namespace BankYouBankruptClientApp.Controllers
return View(APIClient.GetRequest<List<CreditingViewModel>>($"api/Client/getUsersCreditings?userId={APIClient.Client.Id}")); return View(APIClient.GetRequest<List<CreditingViewModel>>($"api/Client/getUsersCreditings?userId={APIClient.Client.Id}"));
} }
[HttpGet]
public IActionResult CreateCrediting()
{
if (APIClient.Client == null)
{
return Redirect("~/Home/Enter");
}
ViewBag.Cards = APIClient.GetRequest<List<CardViewModel>>($"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 #endregion
} }
} }

View File

@ -1,5 +1,5 @@
@{ @{
ViewData["Title"] = "Register"; ViewData["Title"] = "Создание карты";
} }
<div class="text-center"> <div class="text-center">

View File

@ -0,0 +1,27 @@
@{
ViewData["Title"] = "Операция пополнения";
}
<div class="text-center">
<h2 class="display-4">Создание операции</h2>
</div>
<form method="post">
<div class="row">
<div class="col-4">Номер счета:</div>
<div class="col-8">
<select id="cardId" name="cardId" class="form-control" asp-items="@(new SelectList( @ViewBag.Cards, "Id", "Number"))"></select>
</div>
</div>
<div class="row">
<div class="col-4">Cумма операции:</div>
<div class="col-8">
<input type="number" name="sum" />
</div>
</div>
<div class="row">
<div class="col-8"></div>
<div class="col-4">
<input type="submit" value="Создание" class="btn btn-primary" />
</div>
</div>
</form>

View File

@ -1,9 +1,9 @@
@{ @{
ViewData["Title"] = "Register"; ViewData["Title"] = "Операция снятия";
} }
<div class="text-center"> <div class="text-center">
<h2 class="display-4">Создание карты</h2> <h2 class="display-4">Создание операции</h2>
</div> </div>
<form method="post"> <form method="post">
<div class="row"> <div class="row">

View File

@ -18,7 +18,7 @@
return; return;
} }
<p> <p>
<a asp-action="CreateCard">Пополнить средства</a> <a asp-action="CreateCrediting">Пополнить средства</a>
</p> </p>
<table class="table"> <table class="table">
<thead> <thead>

View File

@ -1,5 +1,5 @@
@{ @{
ViewData["Title"] = "Enter"; ViewData["Title"] = "Логин";
} }
<div class="text-center"> <div class="text-center">

View File

@ -3,7 +3,7 @@
@model ClientViewModel @model ClientViewModel
@{ @{
ViewData["Title"] = "Home Page"; ViewData["Title"] = "Страница пользователя";
} }
<div class="text-center"> <div class="text-center">

View File

@ -1,5 +1,5 @@
@{ @{
ViewData["Title"] = "Register"; ViewData["Title"] = "Регистрация";
} }
<div class="text-center"> <div class="text-center">