Добавлена страница для просмотра одной выплаты
This commit is contained in:
parent
050a46e3d1
commit
90a9b1a438
@ -30,7 +30,7 @@ namespace BankDatabaseImplement.Implements
|
||||
if (model.OperatorId.HasValue)
|
||||
{
|
||||
using var context = new BankDatabase();
|
||||
return context.Payments.Include(x => x.Operator)
|
||||
return context.Payments.Include(x => x.Operator).Include(x => x.Deals).ThenInclude(x => x.Deal)
|
||||
.Where(x => x.OperatorId == model.OperatorId)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
@ -38,7 +38,7 @@ namespace BankDatabaseImplement.Implements
|
||||
else
|
||||
{
|
||||
using var context = new BankDatabase();
|
||||
return context.Payments.Include(x => x.Operator)
|
||||
return context.Payments.Include(x => x.Operator).Include(x => x.Deals).ThenInclude(x => x.Deal)
|
||||
.Where(x => x.Id == model.Id)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
@ -52,7 +52,7 @@ namespace BankDatabaseImplement.Implements
|
||||
return null;
|
||||
}
|
||||
using var context = new BankDatabase();
|
||||
return context.Payments.Include(x => x.Operator)
|
||||
return context.Payments.Include(x => x.Operator).Include(x => x.Deals).ThenInclude(x => x.Deal)
|
||||
.FirstOrDefault(x => x.Id == model.Id)
|
||||
?.GetViewModel;
|
||||
}
|
||||
|
@ -177,5 +177,10 @@ namespace OperatorApp.Controllers
|
||||
_paymentLogic.Create(new PaymentBindingModel { OperatorId = APIClient.Operator.Id, DealPayments = DealPayments, });
|
||||
Response.Redirect("Payments");
|
||||
}
|
||||
[HttpGet]
|
||||
public IActionResult Payment(int id)
|
||||
{
|
||||
return View(_paymentLogic.ReadElement(new PaymentSearchModel { Id = id}));
|
||||
}
|
||||
}
|
||||
}
|
28
Bank/OperatorApp/Views/Home/Payment.cshtml
Normal file
28
Bank/OperatorApp/Views/Home/Payment.cshtml
Normal file
@ -0,0 +1,28 @@
|
||||
@using BankContracts.ViewModels
|
||||
|
||||
@model PaymentViewModel
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Payment";
|
||||
}
|
||||
|
||||
<div class="text-center">
|
||||
<h1>Выплата №@Model.Id</h1>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="text-center">
|
||||
@{
|
||||
if (Model == null)
|
||||
{
|
||||
<h3 class="display-4">Авторизируйтесь</h3>
|
||||
return;
|
||||
}
|
||||
}
|
||||
<h3 class="display-4">От @Model.PaymentDate.Date</h3>
|
||||
<h3 class="display-4">Оператор: @Model.OperatorName</h3>
|
||||
<h3 class="display-4">Сделки:</h3>
|
||||
@foreach (var deal in Model.DealPayments){
|
||||
<h5 class="display-4"><b>Сделка №@deal.Value.Id</b>, от @deal.Value.DealDate, номер клиента: @deal.Value.ClientId</h5>
|
||||
}
|
||||
</div>
|
@ -34,6 +34,8 @@
|
||||
<th>
|
||||
Дата
|
||||
</th>
|
||||
<th>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@ -49,6 +51,9 @@
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.PaymentDate)
|
||||
</td>
|
||||
<td>
|
||||
<a asp-action="Payment" asp-route-id="@item.Id">Посмотреть</a>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
|
Loading…
x
Reference in New Issue
Block a user