CreditingFull

This commit is contained in:
shadowik 2023-05-17 15:24:20 +04:00
parent aad67b6137
commit 7b7a136b5c
4 changed files with 61 additions and 3 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

@ -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>