CreditingFull
This commit is contained in:
parent
aad67b6137
commit
7b7a136b5c
@ -202,6 +202,37 @@ namespace BankYouBankruptClientApp.Controllers
|
||||
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
|
||||
}
|
||||
}
|
@ -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>
|
@ -1,9 +1,9 @@
|
||||
@{
|
||||
ViewData["Title"] = "Register";
|
||||
ViewData["Title"] = "Операция снятия";
|
||||
}
|
||||
|
||||
<div class="text-center">
|
||||
<h2 class="display-4">Создание карты</h2>
|
||||
<h2 class="display-4">Создание операции</h2>
|
||||
</div>
|
||||
<form method="post">
|
||||
<div class="row">
|
||||
|
@ -18,7 +18,7 @@
|
||||
return;
|
||||
}
|
||||
<p>
|
||||
<a asp-action="CreateCard">Пополнить средства</a>
|
||||
<a asp-action="CreateCrediting">Пополнить средства</a>
|
||||
</p>
|
||||
<table class="table">
|
||||
<thead>
|
||||
|
Loading…
Reference in New Issue
Block a user