From 90a9b1a438d995ef7da8f9e01f84630cca2a82cd Mon Sep 17 00:00:00 2001 From: abazov73 <92822431+abazov73@users.noreply.github.com> Date: Wed, 17 May 2023 13:42:29 +0400 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B0=20=D1=81=D1=82=D1=80=D0=B0=D0=BD=D0=B8=D1=86=D0=B0?= =?UTF-8?q?=20=D0=B4=D0=BB=D1=8F=20=D0=BF=D1=80=D0=BE=D1=81=D0=BC=D0=BE?= =?UTF-8?q?=D1=82=D1=80=D0=B0=20=D0=BE=D0=B4=D0=BD=D0=BE=D0=B9=20=D0=B2?= =?UTF-8?q?=D1=8B=D0=BF=D0=BB=D0=B0=D1=82=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Implements/PaymentStorage.cs | 6 ++-- .../OperatorApp/Controllers/HomeController.cs | 5 ++++ Bank/OperatorApp/Views/Home/Payment.cshtml | 28 +++++++++++++++++++ Bank/OperatorApp/Views/Home/Payments.cshtml | 5 ++++ 4 files changed, 41 insertions(+), 3 deletions(-) create mode 100644 Bank/OperatorApp/Views/Home/Payment.cshtml diff --git a/Bank/BankDatabaseImplement/Implements/PaymentStorage.cs b/Bank/BankDatabaseImplement/Implements/PaymentStorage.cs index 7f14989..e9c391f 100644 --- a/Bank/BankDatabaseImplement/Implements/PaymentStorage.cs +++ b/Bank/BankDatabaseImplement/Implements/PaymentStorage.cs @@ -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; } diff --git a/Bank/OperatorApp/Controllers/HomeController.cs b/Bank/OperatorApp/Controllers/HomeController.cs index 054bde1..fa40e76 100644 --- a/Bank/OperatorApp/Controllers/HomeController.cs +++ b/Bank/OperatorApp/Controllers/HomeController.cs @@ -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})); + } } } \ No newline at end of file diff --git a/Bank/OperatorApp/Views/Home/Payment.cshtml b/Bank/OperatorApp/Views/Home/Payment.cshtml new file mode 100644 index 0000000..8dec17c --- /dev/null +++ b/Bank/OperatorApp/Views/Home/Payment.cshtml @@ -0,0 +1,28 @@ +@using BankContracts.ViewModels + +@model PaymentViewModel + +@{ + ViewData["Title"] = "Payment"; +} + +
+

Выплата №@Model.Id

+
+ + +
+ @{ + if (Model == null) + { +

Авторизируйтесь

+ return; + } + } +

От @Model.PaymentDate.Date

+

Оператор: @Model.OperatorName

+

Сделки:

+ @foreach (var deal in Model.DealPayments){ +
Сделка №@deal.Value.Id, от @deal.Value.DealDate, номер клиента: @deal.Value.ClientId
+ } +
\ No newline at end of file diff --git a/Bank/OperatorApp/Views/Home/Payments.cshtml b/Bank/OperatorApp/Views/Home/Payments.cshtml index 70a7072..27f3f30 100644 --- a/Bank/OperatorApp/Views/Home/Payments.cshtml +++ b/Bank/OperatorApp/Views/Home/Payments.cshtml @@ -34,6 +34,8 @@ Дата + + @@ -49,6 +51,9 @@ @Html.DisplayFor(modelItem => item.PaymentDate) + + Посмотреть + }