Добавлена страница создания зачисления
This commit is contained in:
parent
90a9b1a438
commit
ca8b59b8aa
@ -17,7 +17,7 @@ namespace BankDatabaseImplement.Implements
|
||||
public List<TransferViewModel> GetFullList()
|
||||
{
|
||||
using var context = new BankDatabase();
|
||||
return context.Transfers.Include(x => x.Payment).Include(x => x.OperatorId)
|
||||
return context.Transfers.Include(x => x.Payment).Include(x => x.Operator)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
@ -30,7 +30,7 @@ namespace BankDatabaseImplement.Implements
|
||||
if (model.DateFrom.HasValue && model.DateTo.HasValue)
|
||||
{
|
||||
using var context = new BankDatabase();
|
||||
return context.Transfers.Include(x => x.Payment).Include(x => x.OperatorId)
|
||||
return context.Transfers.Include(x => x.Payment).Include(x => x.Operator)
|
||||
.Where(x => x.TransferDateTime >= model.DateFrom && x.TransferDateTime <= model.DateTo)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
@ -38,7 +38,7 @@ namespace BankDatabaseImplement.Implements
|
||||
if (model.OperatorId.HasValue)
|
||||
{
|
||||
using var context = new BankDatabase();
|
||||
return context.Transfers.Include(x => x.Payment).Include(x => x.OperatorId)
|
||||
return context.Transfers.Include(x => x.Payment).Include(x => x.Operator)
|
||||
.Where(x => x.OperatorId == model.OperatorId)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
|
@ -182,5 +182,35 @@ namespace OperatorApp.Controllers
|
||||
{
|
||||
return View(_paymentLogic.ReadElement(new PaymentSearchModel { Id = id}));
|
||||
}
|
||||
[HttpGet]
|
||||
public IActionResult Transfers()
|
||||
{
|
||||
if (APIClient.Operator == null)
|
||||
{
|
||||
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||
}
|
||||
return View(_transferLogic.ReadList(new TransferSearchModel { OperatorId = APIClient.Operator.Id }));
|
||||
}
|
||||
[HttpGet]
|
||||
public IActionResult CreateTransfer()
|
||||
{
|
||||
if (APIClient.Operator == null)
|
||||
{
|
||||
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||
}
|
||||
ViewBag.Payments = _paymentLogic.ReadList(new PaymentSearchModel { OperatorId = APIClient.Operator.Id });
|
||||
return View();
|
||||
}
|
||||
[HttpPost]
|
||||
public void CreateTransfer(string amount, int payment)
|
||||
{
|
||||
if (APIClient.Operator == null)
|
||||
{
|
||||
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||
}
|
||||
|
||||
_transferLogic.Create(new TransferBindingModel { OperatorId = APIClient.Operator.Id, Amount = (float)Convert.ToDouble(amount), PaymentId = payment});
|
||||
Response.Redirect("Transfers");
|
||||
}
|
||||
}
|
||||
}
|
22
Bank/OperatorApp/Views/Home/CreateTransfer.cshtml
Normal file
22
Bank/OperatorApp/Views/Home/CreateTransfer.cshtml
Normal file
@ -0,0 +1,22 @@
|
||||
@{
|
||||
ViewData["Title"] = "CreatePayment";
|
||||
}
|
||||
<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="payment" name="payment" class="form-control" asp-items="@(new SelectList(@ViewBag.Payments,"Id", "Id"))"></select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Сумма:</div>
|
||||
<div class="col-8"><input type="text" name="amount" id="amount" /></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>
|
@ -19,7 +19,7 @@
|
||||
return;
|
||||
}
|
||||
}
|
||||
<h3 class="display-4">От @Model.PaymentDate.Date</h3>
|
||||
<h3 class="display-4">От @Model.PaymentDate</h3>
|
||||
<h3 class="display-4">Оператор: @Model.OperatorName</h3>
|
||||
<h3 class="display-4">Сделки:</h3>
|
||||
@foreach (var deal in Model.DealPayments){
|
||||
|
63
Bank/OperatorApp/Views/Home/Transfers.cshtml
Normal file
63
Bank/OperatorApp/Views/Home/Transfers.cshtml
Normal file
@ -0,0 +1,63 @@
|
||||
@using BankContracts.ViewModels
|
||||
|
||||
@model List<TransferViewModel>
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Transfers";
|
||||
}
|
||||
|
||||
<div class="text-center">
|
||||
<h1 class="display-4">Зачисления</h1>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="text-center">
|
||||
@{
|
||||
if (Model == null)
|
||||
{
|
||||
<h3 class="display-4">Авторизируйтесь</h3>
|
||||
return;
|
||||
}
|
||||
|
||||
<p>
|
||||
<a asp-action="CreateTransfer">Создать зачисление</a>
|
||||
</p>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
Номер зачисления
|
||||
</th>
|
||||
<th>
|
||||
Сумма
|
||||
</th>
|
||||
<th>
|
||||
Дата
|
||||
</th>
|
||||
<th>
|
||||
Номер выплаты
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var item in Model)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Id)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Amount)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.TransferDateTime)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.PaymentId)
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
</div>
|
@ -27,7 +27,7 @@
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Payments">Выплаты</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Index">Зачисления</a>
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Transfers">Зачисления</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Privacy">Личные данные</a>
|
||||
|
Loading…
x
Reference in New Issue
Block a user