From 155d44e7af1f4290307b4e9367a1b7653cfc6cd6 Mon Sep 17 00:00:00 2001 From: shadowik Date: Sat, 20 May 2023 00:25:24 +0400 Subject: [PATCH] . --- .../BusinessLogics/AccountLogic.cs | 2 +- .../BankYouBankruptClientApp/Views/Home/CardsList.cshtml | 6 ++++++ .../ViewModels/CashWithdrawalViewModel.cs | 5 ++++- .../ViewModels/Client/Default/CardViewModel.cs | 3 +++ .../BankYouBankruptDatabaseImplement/Models/Card.cs | 4 ++++ .../Models/CashWithdrawal.cs | 1 + 6 files changed, 19 insertions(+), 2 deletions(-) diff --git a/BankYouBankrupt/BankYouBankruptBusinessLogic/BusinessLogics/AccountLogic.cs b/BankYouBankrupt/BankYouBankruptBusinessLogic/BusinessLogics/AccountLogic.cs index bb31910..619e234 100644 --- a/BankYouBankrupt/BankYouBankruptBusinessLogic/BusinessLogics/AccountLogic.cs +++ b/BankYouBankrupt/BankYouBankruptBusinessLogic/BusinessLogics/AccountLogic.cs @@ -149,7 +149,7 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics Dictionary<(int, int), int> cashWithdrawals = _cashWithdrawalLogic.ReadList(new CashWithdrawalSearchModel() { AccountId = AccountId, - }).GroupBy(x => new { x.DateOperation.Month, x.DateOperation.Year }) + }).Where(x => x.DebitingStatus == StatusEnum.Закрыта ).GroupBy(x => new { x.DateOperation.Month, x.DateOperation.Year }) .Select(x => new { x.Key.Month, x.Key.Year, Sum = x.Select(y => y.Sum).Sum() }).ToDictionary(x => (x.Month, x.Year), x => (x.Sum)); Dictionary<(int, int), int> moneyTransfers = _moneyTransferLogic.ReadList(new MoneyTransferSearchModel() diff --git a/BankYouBankrupt/BankYouBankruptClientApp/Views/Home/CardsList.cshtml b/BankYouBankrupt/BankYouBankruptClientApp/Views/Home/CardsList.cshtml index 09d8927..4a9231b 100644 --- a/BankYouBankrupt/BankYouBankruptClientApp/Views/Home/CardsList.cshtml +++ b/BankYouBankrupt/BankYouBankruptClientApp/Views/Home/CardsList.cshtml @@ -26,6 +26,9 @@ Номер счёта + + Баланс + CVC @@ -41,6 +44,9 @@ @Html.DisplayFor(modelItem => item.Number) + + @Html.DisplayFor(modelItem => item.Sum) + @Html.DisplayFor(modelItem => item.CVC) diff --git a/BankYouBankrupt/BankYouBankruptContracts/ViewModels/CashWithdrawalViewModel.cs b/BankYouBankrupt/BankYouBankruptContracts/ViewModels/CashWithdrawalViewModel.cs index 5545a84..9da04c8 100644 --- a/BankYouBankrupt/BankYouBankruptContracts/ViewModels/CashWithdrawalViewModel.cs +++ b/BankYouBankrupt/BankYouBankruptContracts/ViewModels/CashWithdrawalViewModel.cs @@ -1,4 +1,5 @@ -using BankYouBankruptDataModels.Models; +using BankYouBankruptDataModels.Enums; +using BankYouBankruptDataModels.Models; using System; using System.Collections.Generic; using System.ComponentModel; @@ -14,6 +15,8 @@ namespace BankYouBankruptContracts.ViewModels public int DebitingId { get; set; } + public StatusEnum DebitingStatus { get; set; } + [DisplayName("Номер заявки на снятие средств")] public int DebbitingNumber { get; set; } diff --git a/BankYouBankrupt/BankYouBankruptContracts/ViewModels/Client/Default/CardViewModel.cs b/BankYouBankrupt/BankYouBankruptContracts/ViewModels/Client/Default/CardViewModel.cs index 49b3fab..394c157 100644 --- a/BankYouBankrupt/BankYouBankruptContracts/ViewModels/Client/Default/CardViewModel.cs +++ b/BankYouBankrupt/BankYouBankruptContracts/ViewModels/Client/Default/CardViewModel.cs @@ -22,6 +22,9 @@ namespace BankYouBankruptContracts.ViewModels.Client.Default [DisplayName("Номер карты")] public string Number { get; set; } = string.Empty; + [DisplayName("Баланс карты")] + public double Sum { get; set; } + public string CVC { get; set; } = string.Empty; [DisplayName("Период действия")] diff --git a/BankYouBankrupt/BankYouBankruptDatabaseImplement/Models/Card.cs b/BankYouBankrupt/BankYouBankruptDatabaseImplement/Models/Card.cs index 8280e1f..7b931e2 100644 --- a/BankYouBankrupt/BankYouBankruptDatabaseImplement/Models/Card.cs +++ b/BankYouBankrupt/BankYouBankruptDatabaseImplement/Models/Card.cs @@ -24,6 +24,8 @@ namespace BankYouBankruptDatabaseImplement.Models [Required] public int AccountId { get; set; } + public virtual Account Account { get; set; } + [Required] public string Number { get; set; } = string.Empty; @@ -46,6 +48,7 @@ namespace BankYouBankruptDatabaseImplement.Models ClientID = ClientID, ClientSurname = Client.Surname, Number = Number, + Sum = Account.Balance, Period = Period, CVC = CVC }; @@ -56,6 +59,7 @@ namespace BankYouBankruptDatabaseImplement.Models { Id = model.Id, AccountId = model.AccountId, + Account = context.Accounts.First(x => x.Id == model.AccountId), ClientID = model.ClientID, Client = context.Clients.First(x => x.Id == model.ClientID), Number = model.Number, diff --git a/BankYouBankrupt/BankYouBankruptDatabaseImplement/Models/CashWithdrawal.cs b/BankYouBankrupt/BankYouBankruptDatabaseImplement/Models/CashWithdrawal.cs index 89c3bdb..6267279 100644 --- a/BankYouBankrupt/BankYouBankruptDatabaseImplement/Models/CashWithdrawal.cs +++ b/BankYouBankrupt/BankYouBankruptDatabaseImplement/Models/CashWithdrawal.cs @@ -69,6 +69,7 @@ namespace BankYouBankruptDatabaseImplement.Models AccountNumber = Account.AccountNumber, SurmaneCashier = Cashier.Surname, DebbitingNumber = Debiting.Id, + DebitingStatus = Debiting.Status, Sum = Sum, DateOperation = DateOperation };