diff --git a/Bank/BankDatabaseImplement/Implements/TransferStorage.cs b/Bank/BankDatabaseImplement/Implements/TransferStorage.cs index 67fbdcf..4afc47a 100644 --- a/Bank/BankDatabaseImplement/Implements/TransferStorage.cs +++ b/Bank/BankDatabaseImplement/Implements/TransferStorage.cs @@ -17,7 +17,7 @@ namespace BankDatabaseImplement.Implements public List 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(); diff --git a/Bank/OperatorApp/Controllers/HomeController.cs b/Bank/OperatorApp/Controllers/HomeController.cs index fa40e76..4268928 100644 --- a/Bank/OperatorApp/Controllers/HomeController.cs +++ b/Bank/OperatorApp/Controllers/HomeController.cs @@ -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"); + } } } \ No newline at end of file diff --git a/Bank/OperatorApp/Views/Home/CreateTransfer.cshtml b/Bank/OperatorApp/Views/Home/CreateTransfer.cshtml new file mode 100644 index 0000000..9e20259 --- /dev/null +++ b/Bank/OperatorApp/Views/Home/CreateTransfer.cshtml @@ -0,0 +1,22 @@ +@{ + ViewData["Title"] = "CreatePayment"; +} +
+

Создание зачисления

+
+
+
+
Выплата:
+
+ +
+
+
+
Сумма:
+
+
+
+
+
+
+
\ No newline at end of file diff --git a/Bank/OperatorApp/Views/Home/Payment.cshtml b/Bank/OperatorApp/Views/Home/Payment.cshtml index 8dec17c..4a07941 100644 --- a/Bank/OperatorApp/Views/Home/Payment.cshtml +++ b/Bank/OperatorApp/Views/Home/Payment.cshtml @@ -19,7 +19,7 @@ return; } } -

От @Model.PaymentDate.Date

+

От @Model.PaymentDate

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

Сделки:

@foreach (var deal in Model.DealPayments){ diff --git a/Bank/OperatorApp/Views/Home/Transfers.cshtml b/Bank/OperatorApp/Views/Home/Transfers.cshtml new file mode 100644 index 0000000..71a73fe --- /dev/null +++ b/Bank/OperatorApp/Views/Home/Transfers.cshtml @@ -0,0 +1,63 @@ +@using BankContracts.ViewModels + +@model List + +@{ + ViewData["Title"] = "Transfers"; +} + +
+

Зачисления

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

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

+ return; + } + +

+ Создать зачисление +

+ + + + + + + + + + + @foreach (var item in Model) + { + + + + + + + } + +
+ Номер зачисления + + Сумма + + Дата + + Номер выплаты +
+ @Html.DisplayFor(modelItem => item.Id) + + @Html.DisplayFor(modelItem => item.Amount) + + @Html.DisplayFor(modelItem => item.TransferDateTime) + + @Html.DisplayFor(modelItem => item.PaymentId) +
+ } +
\ No newline at end of file diff --git a/Bank/OperatorApp/Views/Shared/_Layout.cshtml b/Bank/OperatorApp/Views/Shared/_Layout.cshtml index 61df6a9..2f27d5b 100644 --- a/Bank/OperatorApp/Views/Shared/_Layout.cshtml +++ b/Bank/OperatorApp/Views/Shared/_Layout.cshtml @@ -27,7 +27,7 @@ Выплаты