diff --git a/BankYouBankrupt/BankYouBankruptBusinessLogic/BusinessLogics/CardLogic.cs b/BankYouBankrupt/BankYouBankruptBusinessLogic/BusinessLogics/CardLogic.cs index 52cb9a6..b407830 100644 --- a/BankYouBankrupt/BankYouBankruptBusinessLogic/BusinessLogics/CardLogic.cs +++ b/BankYouBankrupt/BankYouBankruptBusinessLogic/BusinessLogics/CardLogic.cs @@ -3,12 +3,15 @@ using BankYouBankruptContracts.BindingModels; using BankYouBankruptContracts.BusinessLogicsContracts; using BankYouBankruptContracts.SearchModels; using BankYouBankruptContracts.StoragesContracts; -using BankYouBankruptContracts.ViewModels; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using BankYouBankruptContracts.ViewModels.Client.Default; +using BankYouBankruptContracts.ViewModels.Client.Diagram; +using BankYouBankruptDataModels.Enums; +using DocumentFormat.OpenXml.Drawing; namespace BankYouBankruptBusinessLogic.BusinessLogics { @@ -17,11 +20,16 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics private readonly ILogger _logger; private readonly ICardStorage _cardStorage; private readonly IAccountStorage _accountStorage; + private readonly IDebitingLogic _debitingLogic; + private readonly ICreditingLogic _creditingLogic; - public CardLogic(ILogger logger, ICardStorage cardStorage, IAccountStorage accountStorage) { + public CardLogic(ILogger logger, ICardStorage cardStorage, IAccountStorage accountStorage, + IDebitingLogic debitingLogic, ICreditingLogic creditingLogic) { _logger = logger; _cardStorage = cardStorage; _accountStorage = accountStorage; + _debitingLogic = debitingLogic; + _creditingLogic = creditingLogic; } public bool Create(CardBindingModel model) @@ -88,6 +96,31 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics return true; } + public List GetMonthInfo(int CardId) { + + Dictionary<(int?, int?), int> debitings = _debitingLogic.ReadList(new DebitingSearchModel() + { + CardId = CardId, + Status = StatusEnum.Закрыта + }).GroupBy(x => new { x.DateClose?.Month, x.DateClose?.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> creditings = _creditingLogic.ReadList(new CreditingSearchModel() + { + CardId = CardId, + Status = StatusEnum.Закрыта + }).GroupBy(x => new { x.DateClose?.Month, x.DateClose?.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)); + + List result = new(); + foreach (var key in debitings.Keys.Union(creditings.Keys)) { + int sum = 0; + if (debitings.ContainsKey(key)) sum -= debitings.GetValueOrDefault(key); + if (creditings.ContainsKey(key)) sum += creditings.GetValueOrDefault(key); + result.Add(new ClientDiagramElementsViewModel() { Name = Enum.GetName(typeof(Months), key.Item1) + " " + key.Item2.ToString(), Value = sum}); + } + return result; + } + private void CheckModel(CardBindingModel model, bool withParams = true) { if (model == null) diff --git a/BankYouBankrupt/BankYouBankruptBusinessLogic/BusinessLogics/ClientLogic.cs b/BankYouBankrupt/BankYouBankruptBusinessLogic/BusinessLogics/ClientLogic.cs index 7673514..8bca19b 100644 --- a/BankYouBankrupt/BankYouBankruptBusinessLogic/BusinessLogics/ClientLogic.cs +++ b/BankYouBankrupt/BankYouBankruptBusinessLogic/BusinessLogics/ClientLogic.cs @@ -3,12 +3,12 @@ using BankYouBankruptContracts.BindingModels; using BankYouBankruptContracts.BusinessLogicsContracts; using BankYouBankruptContracts.SearchModels; using BankYouBankruptContracts.StoragesContracts; -using BankYouBankruptContracts.ViewModels; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using BankYouBankruptContracts.ViewModels.Client.Default; namespace BankYouBankruptBusinessLogic.BusinessLogics { diff --git a/BankYouBankrupt/BankYouBankruptBusinessLogic/BusinessLogics/CreditingLogic.cs b/BankYouBankrupt/BankYouBankruptBusinessLogic/BusinessLogics/CreditingLogic.cs index 71f1cce..ea54126 100644 --- a/BankYouBankrupt/BankYouBankruptBusinessLogic/BusinessLogics/CreditingLogic.cs +++ b/BankYouBankrupt/BankYouBankruptBusinessLogic/BusinessLogics/CreditingLogic.cs @@ -3,12 +3,12 @@ using BankYouBankruptContracts.BindingModels; using BankYouBankruptContracts.BusinessLogicsContracts; using BankYouBankruptContracts.SearchModels; using BankYouBankruptContracts.StoragesContracts; -using BankYouBankruptContracts.ViewModels; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using BankYouBankruptContracts.ViewModels.Client.Default; namespace BankYouBankruptBusinessLogic.BusinessLogics { @@ -16,14 +16,10 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics { private readonly ILogger _logger; private readonly ICreditingStorage _creditingStorage; - private readonly ICardLogic _cardLogic; - private readonly IAccountLogic _accountLogic; - public CreditingLogic(ILogger logger, ICreditingStorage creditingStorage, ICardLogic cardLogic, IAccountLogic accountLogic) { + public CreditingLogic(ILogger logger, ICreditingStorage creditingStorage) { _logger = logger; _creditingStorage = creditingStorage; - _cardLogic = cardLogic; - _accountLogic = accountLogic; } public bool Create(CreditingBindingModel model) diff --git a/BankYouBankrupt/BankYouBankruptBusinessLogic/BusinessLogics/DebitingLogic.cs b/BankYouBankrupt/BankYouBankruptBusinessLogic/BusinessLogics/DebitingLogic.cs index ef4aa56..c3e5d49 100644 --- a/BankYouBankrupt/BankYouBankruptBusinessLogic/BusinessLogics/DebitingLogic.cs +++ b/BankYouBankrupt/BankYouBankruptBusinessLogic/BusinessLogics/DebitingLogic.cs @@ -3,12 +3,12 @@ using BankYouBankruptContracts.BindingModels; using BankYouBankruptContracts.BusinessLogicsContracts; using BankYouBankruptContracts.SearchModels; using BankYouBankruptContracts.StoragesContracts; -using BankYouBankruptContracts.ViewModels; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using BankYouBankruptContracts.ViewModels.Client.Default; namespace BankYouBankruptBusinessLogic.BusinessLogics { diff --git a/BankYouBankrupt/BankYouBankruptBusinessLogic/BusinessLogics/ReportClientLogic.cs b/BankYouBankrupt/BankYouBankruptBusinessLogic/BusinessLogics/ReportClientLogic.cs index 39e2fc9..c2a2eef 100644 --- a/BankYouBankrupt/BankYouBankruptBusinessLogic/BusinessLogics/ReportClientLogic.cs +++ b/BankYouBankrupt/BankYouBankruptBusinessLogic/BusinessLogics/ReportClientLogic.cs @@ -4,12 +4,12 @@ using BankYouBankruptContracts.BindingModels; using BankYouBankruptContracts.BusinessLogicsContracts; using BankYouBankruptContracts.SearchModels; using BankYouBankruptContracts.StoragesContracts; -using BankYouBankruptContracts.ViewModels; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using BankYouBankruptContracts.ViewModels.Client.Reports; namespace BankYouBankruptBusinessLogic.BusinessLogics { diff --git a/BankYouBankrupt/BankYouBankruptBusinessLogic/OfficePackage/HelperModels/PdfInfo.cs b/BankYouBankrupt/BankYouBankruptBusinessLogic/OfficePackage/HelperModels/PdfInfo.cs index 97e0e82..309dfba 100644 --- a/BankYouBankrupt/BankYouBankruptBusinessLogic/OfficePackage/HelperModels/PdfInfo.cs +++ b/BankYouBankrupt/BankYouBankruptBusinessLogic/OfficePackage/HelperModels/PdfInfo.cs @@ -1,4 +1,5 @@ using BankYouBankruptContracts.ViewModels; +using BankYouBankruptContracts.ViewModels.Client.Reports; using System; using System.Collections.Generic; using System.Linq; diff --git a/BankYouBankrupt/BankYouBankruptCashierApp/APICashier.cs b/BankYouBankrupt/BankYouBankruptCashierApp/APICashier.cs index 27f4f64..0fec5a9 100644 --- a/BankYouBankrupt/BankYouBankruptCashierApp/APICashier.cs +++ b/BankYouBankrupt/BankYouBankruptCashierApp/APICashier.cs @@ -1,4 +1,5 @@ using BankYouBankruptContracts.ViewModels; +using BankYouBankruptContracts.ViewModels.Client.Default; using Newtonsoft.Json; using System.Net.Http.Headers; using System.Text; diff --git a/BankYouBankrupt/BankYouBankruptCashierApp/Controllers/HomeController.cs b/BankYouBankrupt/BankYouBankruptCashierApp/Controllers/HomeController.cs index 7c9ebbf..7106767 100644 --- a/BankYouBankrupt/BankYouBankruptCashierApp/Controllers/HomeController.cs +++ b/BankYouBankrupt/BankYouBankruptCashierApp/Controllers/HomeController.cs @@ -1,6 +1,7 @@ using BankYouBankruptCashierApp.Models; using BankYouBankruptContracts.BindingModels; using BankYouBankruptContracts.ViewModels; +using BankYouBankruptContracts.ViewModels.Client.Default; using BankYouBankruptDataModels.Enums; using Microsoft.AspNetCore.Mvc; using System.Diagnostics; @@ -8,7 +9,7 @@ using System.Xml.Linq; namespace BankYouBankruptCashierApp.Controllers { - public class HomeController : Controller + public class HomeController : Controller { private readonly ILogger _logger; diff --git a/BankYouBankrupt/BankYouBankruptCashierApp/Views/Home/Crediting.cshtml b/BankYouBankrupt/BankYouBankruptCashierApp/Views/Home/Crediting.cshtml index 2594260..afccf28 100644 --- a/BankYouBankrupt/BankYouBankruptCashierApp/Views/Home/Crediting.cshtml +++ b/BankYouBankrupt/BankYouBankruptCashierApp/Views/Home/Crediting.cshtml @@ -1,4 +1,4 @@ -@using BankYouBankruptContracts.ViewModels +@using BankYouBankruptContracts.ViewModels.Client.Default @model List diff --git a/BankYouBankrupt/BankYouBankruptCashierApp/Views/Home/Debiting.cshtml b/BankYouBankrupt/BankYouBankruptCashierApp/Views/Home/Debiting.cshtml index 50d0297..f134ddb 100644 --- a/BankYouBankrupt/BankYouBankruptCashierApp/Views/Home/Debiting.cshtml +++ b/BankYouBankrupt/BankYouBankruptCashierApp/Views/Home/Debiting.cshtml @@ -1,4 +1,5 @@ -@using BankYouBankruptContracts.ViewModels +@using BankYouBankruptContracts.ViewModels.Client.Default + @model List diff --git a/BankYouBankrupt/BankYouBankruptClientApp/APIClient.cs b/BankYouBankrupt/BankYouBankruptClientApp/APIClient.cs index 860db89..bf69f31 100644 --- a/BankYouBankrupt/BankYouBankruptClientApp/APIClient.cs +++ b/BankYouBankrupt/BankYouBankruptClientApp/APIClient.cs @@ -1,4 +1,4 @@ -using BankYouBankruptContracts.ViewModels; +using BankYouBankruptContracts.ViewModels.Client.Default; using Newtonsoft.Json; using System.Net.Http.Headers; using System.Text; diff --git a/BankYouBankrupt/BankYouBankruptClientApp/Controllers/HomeController.cs b/BankYouBankrupt/BankYouBankruptClientApp/Controllers/HomeController.cs index de9a87e..504fba4 100644 --- a/BankYouBankrupt/BankYouBankruptClientApp/Controllers/HomeController.cs +++ b/BankYouBankrupt/BankYouBankruptClientApp/Controllers/HomeController.cs @@ -1,6 +1,9 @@ using BankYouBankruptClientApp.Models; using BankYouBankruptContracts.BindingModels; using BankYouBankruptContracts.ViewModels; +using BankYouBankruptContracts.ViewModels.Client.Default; +using BankYouBankruptContracts.ViewModels.Client.Reports; +using BankYouBankruptContracts.ViewModels.Client.Diagram; using BankYouBankruptDataModels.Enums; using BankYouBankruptСlientApp; using Microsoft.AspNetCore.Mvc; @@ -24,7 +27,7 @@ namespace BankYouBankruptClientApp.Controllers _logger = logger; } - + #region Профиль, вход и регистрация [HttpGet] public IActionResult Profile() { @@ -103,6 +106,7 @@ namespace BankYouBankruptClientApp.Controllers return; } + #endregion #region Карты [HttpGet] @@ -244,7 +248,6 @@ namespace BankYouBankruptClientApp.Controllers #endregion - #region Получение отчёта PDF [HttpGet] @@ -335,7 +338,8 @@ namespace BankYouBankruptClientApp.Controllers #endregion - [HttpGet] + #region Получение отчета по картам + [HttpGet] public IActionResult ReportWithCards() { if (APIClient.Client == null) @@ -396,5 +400,36 @@ namespace BankYouBankruptClientApp.Controllers Operations = result, }); } + #endregion + + [HttpGet] + public IActionResult Diagram() { + if (APIClient.Client == null) + { + return Redirect("~/Home/Enter"); + } + + ViewBag.Cards = APIClient.GetRequest>($"api/Card/GetUsersCardsList?id={APIClient.Client.Id}"); + + + return View(); + } + + [HttpPost] + public IActionResult Diagram(int cardId) + { + if (APIClient.Client == null) + { + return Redirect("~/Home/Enter"); + } + + ViewBag.Cards = APIClient.GetRequest>($"api/Card/GetUsersCardsList?id={APIClient.Client.Id}"); + + + return View(new ClientDiagramViewModel() { + DiagramName = "Hello World", + Elements = APIClient.GetRequest>($"api/Card/getCardMonthResult?cardId={cardId}") + }); + } } } \ No newline at end of file diff --git a/BankYouBankrupt/BankYouBankruptClientApp/Views/Home/CardsList.cshtml b/BankYouBankrupt/BankYouBankruptClientApp/Views/Home/CardsList.cshtml index 95ff86a..09d8927 100644 --- a/BankYouBankrupt/BankYouBankruptClientApp/Views/Home/CardsList.cshtml +++ b/BankYouBankrupt/BankYouBankruptClientApp/Views/Home/CardsList.cshtml @@ -1,4 +1,4 @@ -@using BankYouBankruptContracts.ViewModels +@using BankYouBankruptContracts.ViewModels.Client.Default @model List diff --git a/BankYouBankrupt/BankYouBankruptClientApp/Views/Home/CreditingList.cshtml b/BankYouBankrupt/BankYouBankruptClientApp/Views/Home/CreditingList.cshtml index 1ff2b7c..54649be 100644 --- a/BankYouBankrupt/BankYouBankruptClientApp/Views/Home/CreditingList.cshtml +++ b/BankYouBankrupt/BankYouBankruptClientApp/Views/Home/CreditingList.cshtml @@ -1,4 +1,4 @@ -@using BankYouBankruptContracts.ViewModels +@using BankYouBankruptContracts.ViewModels.Client.Default @model List diff --git a/BankYouBankrupt/BankYouBankruptClientApp/Views/Home/DebitingList.cshtml b/BankYouBankrupt/BankYouBankruptClientApp/Views/Home/DebitingList.cshtml index 65298a2..6956490 100644 --- a/BankYouBankrupt/BankYouBankruptClientApp/Views/Home/DebitingList.cshtml +++ b/BankYouBankrupt/BankYouBankruptClientApp/Views/Home/DebitingList.cshtml @@ -1,4 +1,4 @@ -@using BankYouBankruptContracts.ViewModels +@using BankYouBankruptContracts.ViewModels.Client.Default @model List diff --git a/BankYouBankrupt/BankYouBankruptClientApp/Views/Home/Diagram.cshtml b/BankYouBankrupt/BankYouBankruptClientApp/Views/Home/Diagram.cshtml new file mode 100644 index 0000000..921dba1 --- /dev/null +++ b/BankYouBankrupt/BankYouBankruptClientApp/Views/Home/Diagram.cshtml @@ -0,0 +1,78 @@ +@using BankYouBankruptContracts.ViewModels.Client.Diagram + +@model ClientDiagramViewModel + +@{ + ViewData["Title"] = "Диаграмма"; +} + +
+

Диаграмма по месяцам

+
+ +
+
+
Номер счета:
+
+ +
+
+
+
+
+ +
+
+
+ +@if (Model == null) return; + +
+
+ +
+ @foreach (var info in Model.Elements) { + + } +
+
+
+ + + diff --git a/BankYouBankrupt/BankYouBankruptClientApp/Views/Home/Profile.cshtml b/BankYouBankrupt/BankYouBankruptClientApp/Views/Home/Profile.cshtml index 476cea1..525c03d 100644 --- a/BankYouBankrupt/BankYouBankruptClientApp/Views/Home/Profile.cshtml +++ b/BankYouBankrupt/BankYouBankruptClientApp/Views/Home/Profile.cshtml @@ -1,4 +1,4 @@ -@using BankYouBankruptContracts.ViewModels +@using BankYouBankruptContracts.ViewModels.Client.Default @model ClientViewModel diff --git a/BankYouBankrupt/BankYouBankruptClientApp/Views/Home/ReportWithCards.cshtml b/BankYouBankrupt/BankYouBankruptClientApp/Views/Home/ReportWithCards.cshtml index 5be8d19..ef5dbc1 100644 --- a/BankYouBankrupt/BankYouBankruptClientApp/Views/Home/ReportWithCards.cshtml +++ b/BankYouBankrupt/BankYouBankruptClientApp/Views/Home/ReportWithCards.cshtml @@ -1,4 +1,4 @@ -@using BankYouBankruptContracts.ViewModels +@using BankYouBankruptContracts.ViewModels.Client.Reports; @model ReportClientCardsViewModel diff --git a/BankYouBankrupt/BankYouBankruptClientApp/Views/Shared/_Layout.cshtml b/BankYouBankrupt/BankYouBankruptClientApp/Views/Shared/_Layout.cshtml index 05efbac..f7513f2 100644 --- a/BankYouBankrupt/BankYouBankruptClientApp/Views/Shared/_Layout.cshtml +++ b/BankYouBankrupt/BankYouBankruptClientApp/Views/Shared/_Layout.cshtml @@ -40,6 +40,9 @@ + } } diff --git a/BankYouBankrupt/BankYouBankruptContracts/BusinessLogicsContracts/ICardLogic.cs b/BankYouBankrupt/BankYouBankruptContracts/BusinessLogicsContracts/ICardLogic.cs index a850916..991b9c2 100644 --- a/BankYouBankrupt/BankYouBankruptContracts/BusinessLogicsContracts/ICardLogic.cs +++ b/BankYouBankrupt/BankYouBankruptContracts/BusinessLogicsContracts/ICardLogic.cs @@ -1,6 +1,7 @@ using BankYouBankruptContracts.BindingModels; using BankYouBankruptContracts.SearchModels; -using BankYouBankruptContracts.ViewModels; +using BankYouBankruptContracts.ViewModels.Client.Default; +using BankYouBankruptContracts.ViewModels.Client.Diagram; using System; using System.Collections.Generic; using System.Linq; @@ -20,5 +21,7 @@ namespace BankYouBankruptContracts.BusinessLogicsContracts bool Update(CardBindingModel model); bool Delete(CardBindingModel model); + + public List GetMonthInfo(int CardId); } } diff --git a/BankYouBankrupt/BankYouBankruptContracts/BusinessLogicsContracts/IClientLogic.cs b/BankYouBankrupt/BankYouBankruptContracts/BusinessLogicsContracts/IClientLogic.cs index 6190a1a..154467a 100644 --- a/BankYouBankrupt/BankYouBankruptContracts/BusinessLogicsContracts/IClientLogic.cs +++ b/BankYouBankrupt/BankYouBankruptContracts/BusinessLogicsContracts/IClientLogic.cs @@ -1,6 +1,6 @@ using BankYouBankruptContracts.BindingModels; using BankYouBankruptContracts.SearchModels; -using BankYouBankruptContracts.ViewModels; +using BankYouBankruptContracts.ViewModels.Client.Default; using System; using System.Collections.Generic; using System.Linq; @@ -20,5 +20,6 @@ namespace BankYouBankruptContracts.BusinessLogicsContracts bool Update(ClientBindingModel model); bool Delete(ClientBindingModel model); + } } diff --git a/BankYouBankrupt/BankYouBankruptContracts/BusinessLogicsContracts/ICreditingLogic.cs b/BankYouBankrupt/BankYouBankruptContracts/BusinessLogicsContracts/ICreditingLogic.cs index 045f961..d36178d 100644 --- a/BankYouBankrupt/BankYouBankruptContracts/BusinessLogicsContracts/ICreditingLogic.cs +++ b/BankYouBankrupt/BankYouBankruptContracts/BusinessLogicsContracts/ICreditingLogic.cs @@ -1,6 +1,6 @@ using BankYouBankruptContracts.BindingModels; using BankYouBankruptContracts.SearchModels; -using BankYouBankruptContracts.ViewModels; +using BankYouBankruptContracts.ViewModels.Client.Default; using System; using System.Collections.Generic; using System.Linq; diff --git a/BankYouBankrupt/BankYouBankruptContracts/BusinessLogicsContracts/IDebitingLogic.cs b/BankYouBankrupt/BankYouBankruptContracts/BusinessLogicsContracts/IDebitingLogic.cs index f588388..03a2bd8 100644 --- a/BankYouBankrupt/BankYouBankruptContracts/BusinessLogicsContracts/IDebitingLogic.cs +++ b/BankYouBankrupt/BankYouBankruptContracts/BusinessLogicsContracts/IDebitingLogic.cs @@ -1,6 +1,6 @@ using BankYouBankruptContracts.BindingModels; using BankYouBankruptContracts.SearchModels; -using BankYouBankruptContracts.ViewModels; +using BankYouBankruptContracts.ViewModels.Client.Default; using System; using System.Collections.Generic; using System.Linq; diff --git a/BankYouBankrupt/BankYouBankruptContracts/BusinessLogicsContracts/IReportClientLogic.cs b/BankYouBankrupt/BankYouBankruptContracts/BusinessLogicsContracts/IReportClientLogic.cs index 03c7b09..3cf9a60 100644 --- a/BankYouBankrupt/BankYouBankruptContracts/BusinessLogicsContracts/IReportClientLogic.cs +++ b/BankYouBankrupt/BankYouBankruptContracts/BusinessLogicsContracts/IReportClientLogic.cs @@ -1,6 +1,6 @@ using BankYouBankruptContracts.BindingModels; using BankYouBankruptContracts.SearchModels; -using BankYouBankruptContracts.ViewModels; +using BankYouBankruptContracts.ViewModels.Client.Reports; using System; using System.Collections.Generic; using System.Linq; diff --git a/BankYouBankrupt/BankYouBankruptContracts/StoragesContracts/ICardStorage.cs b/BankYouBankrupt/BankYouBankruptContracts/StoragesContracts/ICardStorage.cs index 1d53ad5..949a5f7 100644 --- a/BankYouBankrupt/BankYouBankruptContracts/StoragesContracts/ICardStorage.cs +++ b/BankYouBankrupt/BankYouBankruptContracts/StoragesContracts/ICardStorage.cs @@ -1,6 +1,6 @@ using BankYouBankruptContracts.BindingModels; using BankYouBankruptContracts.SearchModels; -using BankYouBankruptContracts.ViewModels; +using BankYouBankruptContracts.ViewModels.Client.Default; using System; using System.Collections.Generic; using System.Linq; diff --git a/BankYouBankrupt/BankYouBankruptContracts/StoragesContracts/IClientStorage.cs b/BankYouBankrupt/BankYouBankruptContracts/StoragesContracts/IClientStorage.cs index 3b2083a..6b85911 100644 --- a/BankYouBankrupt/BankYouBankruptContracts/StoragesContracts/IClientStorage.cs +++ b/BankYouBankrupt/BankYouBankruptContracts/StoragesContracts/IClientStorage.cs @@ -1,6 +1,6 @@ using BankYouBankruptContracts.BindingModels; using BankYouBankruptContracts.SearchModels; -using BankYouBankruptContracts.ViewModels; +using BankYouBankruptContracts.ViewModels.Client.Default; using System; using System.Collections.Generic; using System.Linq; diff --git a/BankYouBankrupt/BankYouBankruptContracts/StoragesContracts/ICreditingStorage.cs b/BankYouBankrupt/BankYouBankruptContracts/StoragesContracts/ICreditingStorage.cs index 306b8a4..412b900 100644 --- a/BankYouBankrupt/BankYouBankruptContracts/StoragesContracts/ICreditingStorage.cs +++ b/BankYouBankrupt/BankYouBankruptContracts/StoragesContracts/ICreditingStorage.cs @@ -1,6 +1,6 @@ using BankYouBankruptContracts.BindingModels; using BankYouBankruptContracts.SearchModels; -using BankYouBankruptContracts.ViewModels; +using BankYouBankruptContracts.ViewModels.Client.Default; using System; using System.Collections.Generic; using System.Linq; diff --git a/BankYouBankrupt/BankYouBankruptContracts/StoragesContracts/IDebitingStorage.cs b/BankYouBankrupt/BankYouBankruptContracts/StoragesContracts/IDebitingStorage.cs index bd7cea9..0d9bda2 100644 --- a/BankYouBankrupt/BankYouBankruptContracts/StoragesContracts/IDebitingStorage.cs +++ b/BankYouBankrupt/BankYouBankruptContracts/StoragesContracts/IDebitingStorage.cs @@ -1,6 +1,6 @@ using BankYouBankruptContracts.BindingModels; using BankYouBankruptContracts.SearchModels; -using BankYouBankruptContracts.ViewModels; +using BankYouBankruptContracts.ViewModels.Client.Default; using System; using System.Collections.Generic; using System.Linq; diff --git a/BankYouBankrupt/BankYouBankruptContracts/ViewModels/CardViewModel.cs b/BankYouBankrupt/BankYouBankruptContracts/ViewModels/Client/Default/CardViewModel.cs similarity index 87% rename from BankYouBankrupt/BankYouBankruptContracts/ViewModels/CardViewModel.cs rename to BankYouBankrupt/BankYouBankruptContracts/ViewModels/Client/Default/CardViewModel.cs index d434f46..49b3fab 100644 --- a/BankYouBankrupt/BankYouBankruptContracts/ViewModels/CardViewModel.cs +++ b/BankYouBankrupt/BankYouBankruptContracts/ViewModels/Client/Default/CardViewModel.cs @@ -6,9 +6,9 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace BankYouBankruptContracts.ViewModels +namespace BankYouBankruptContracts.ViewModels.Client.Default { - public class CardViewModel : ICardModel + public class CardViewModel : ICardModel { public int Id { get; set; } diff --git a/BankYouBankrupt/BankYouBankruptContracts/ViewModels/ClientViewModel.cs b/BankYouBankrupt/BankYouBankruptContracts/ViewModels/Client/Default/ClientViewModel.cs similarity index 93% rename from BankYouBankrupt/BankYouBankruptContracts/ViewModels/ClientViewModel.cs rename to BankYouBankrupt/BankYouBankruptContracts/ViewModels/Client/Default/ClientViewModel.cs index fd790a6..ab442be 100644 --- a/BankYouBankrupt/BankYouBankruptContracts/ViewModels/ClientViewModel.cs +++ b/BankYouBankrupt/BankYouBankruptContracts/ViewModels/Client/Default/ClientViewModel.cs @@ -6,7 +6,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace BankYouBankruptContracts.ViewModels +namespace BankYouBankruptContracts.ViewModels.Client.Default { public class ClientViewModel : IClientModel { diff --git a/BankYouBankrupt/BankYouBankruptContracts/ViewModels/CreditingViewModel.cs b/BankYouBankrupt/BankYouBankruptContracts/ViewModels/Client/Default/CreditingViewModel.cs similarity index 88% rename from BankYouBankrupt/BankYouBankruptContracts/ViewModels/CreditingViewModel.cs rename to BankYouBankrupt/BankYouBankruptContracts/ViewModels/Client/Default/CreditingViewModel.cs index 2b28318..0567da3 100644 --- a/BankYouBankrupt/BankYouBankruptContracts/ViewModels/CreditingViewModel.cs +++ b/BankYouBankrupt/BankYouBankruptContracts/ViewModels/Client/Default/CreditingViewModel.cs @@ -7,9 +7,9 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace BankYouBankruptContracts.ViewModels +namespace BankYouBankruptContracts.ViewModels.Client.Default { - public class CreditingViewModel : ICreditingModel + public class CreditingViewModel : ICreditingModel { public int Id { get; set; } diff --git a/BankYouBankrupt/BankYouBankruptContracts/ViewModels/DebitingViewModel.cs b/BankYouBankrupt/BankYouBankruptContracts/ViewModels/Client/Default/DebitingViewModel.cs similarity index 59% rename from BankYouBankrupt/BankYouBankruptContracts/ViewModels/DebitingViewModel.cs rename to BankYouBankrupt/BankYouBankruptContracts/ViewModels/Client/Default/DebitingViewModel.cs index 6227a20..887c71e 100644 --- a/BankYouBankrupt/BankYouBankruptContracts/ViewModels/DebitingViewModel.cs +++ b/BankYouBankrupt/BankYouBankruptContracts/ViewModels/Client/Default/DebitingViewModel.cs @@ -7,9 +7,9 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace BankYouBankruptContracts.ViewModels +namespace BankYouBankruptContracts.ViewModels.Client.Default { - public class DebitingViewModel : IDebitingModel + public class DebitingViewModel : IDebitingModel { public int Id { get; set; } @@ -22,12 +22,12 @@ namespace BankYouBankruptContracts.ViewModels public int Sum { get; set; } [DisplayName("Дата открытия заявки")] - public DateTime DateOpen { get; set; } = DateTime.Now; + public DateTime DateOpen { get; set; } = DateTime.Now; - [DisplayName("Дата закрытия заявки")] - public DateTime? DateClose { get; set; } + [DisplayName("Дата закрытия заявки")] + public DateTime? DateClose { get; set; } - [DisplayName("Статус заявки")] - public StatusEnum Status { get; set; } - } + [DisplayName("Статус заявки")] + public StatusEnum Status { get; set; } + } } diff --git a/BankYouBankrupt/BankYouBankruptContracts/ViewModels/Client/Diagram/ClientDiagramElementsViewModel.cs b/BankYouBankrupt/BankYouBankruptContracts/ViewModels/Client/Diagram/ClientDiagramElementsViewModel.cs new file mode 100644 index 0000000..7c6d454 --- /dev/null +++ b/BankYouBankrupt/BankYouBankruptContracts/ViewModels/Client/Diagram/ClientDiagramElementsViewModel.cs @@ -0,0 +1,17 @@ +using BankYouBankruptDataModels.Models; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BankYouBankruptContracts.ViewModels.Client.Diagram +{ + public class ClientDiagramElementsViewModel + { + public string Name { get; set; } = "Column"; + public int Value { get; set; } = 0; + + } +} diff --git a/BankYouBankrupt/BankYouBankruptContracts/ViewModels/Client/Diagram/ClientDiagramViewModel.cs b/BankYouBankrupt/BankYouBankruptContracts/ViewModels/Client/Diagram/ClientDiagramViewModel.cs new file mode 100644 index 0000000..1dd2f1f --- /dev/null +++ b/BankYouBankrupt/BankYouBankruptContracts/ViewModels/Client/Diagram/ClientDiagramViewModel.cs @@ -0,0 +1,17 @@ +using BankYouBankruptDataModels.Models; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BankYouBankruptContracts.ViewModels.Client.Diagram +{ + public class ClientDiagramViewModel + { + public string DiagramName { get; set; } = "Diagram Name"; + + public List Elements { get; set; } = new(); + } +} diff --git a/BankYouBankrupt/BankYouBankruptContracts/ViewModels/CheckboxViewModel.cs b/BankYouBankrupt/BankYouBankruptContracts/ViewModels/Client/Reports/CheckboxViewModel.cs similarity index 85% rename from BankYouBankrupt/BankYouBankruptContracts/ViewModels/CheckboxViewModel.cs rename to BankYouBankrupt/BankYouBankruptContracts/ViewModels/Client/Reports/CheckboxViewModel.cs index a336b18..85d8bb5 100644 --- a/BankYouBankrupt/BankYouBankruptContracts/ViewModels/CheckboxViewModel.cs +++ b/BankYouBankrupt/BankYouBankruptContracts/ViewModels/Client/Reports/CheckboxViewModel.cs @@ -6,7 +6,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace BankYouBankruptContracts.ViewModels +namespace BankYouBankruptContracts.ViewModels.Client.Reports { public class CheckboxViewModel { diff --git a/BankYouBankrupt/BankYouBankruptContracts/ViewModels/ReportCardViewModel.cs b/BankYouBankrupt/BankYouBankruptContracts/ViewModels/Client/Reports/ReportCardViewModel.cs similarity index 52% rename from BankYouBankrupt/BankYouBankruptContracts/ViewModels/ReportCardViewModel.cs rename to BankYouBankrupt/BankYouBankruptContracts/ViewModels/Client/Reports/ReportCardViewModel.cs index 57ce51b..336290b 100644 --- a/BankYouBankrupt/BankYouBankruptContracts/ViewModels/ReportCardViewModel.cs +++ b/BankYouBankrupt/BankYouBankruptContracts/ViewModels/Client/Reports/ReportCardViewModel.cs @@ -4,9 +4,9 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace BankYouBankruptContracts.ViewModels +namespace BankYouBankruptContracts.ViewModels.Client.Reports { - internal class ReportCardViewModel - { - } + internal class ReportCardViewModel + { + } } diff --git a/BankYouBankrupt/BankYouBankruptContracts/ViewModels/ReportClientCardsViewModel.cs b/BankYouBankrupt/BankYouBankruptContracts/ViewModels/Client/Reports/ReportClientCardsViewModel.cs similarity index 84% rename from BankYouBankrupt/BankYouBankruptContracts/ViewModels/ReportClientCardsViewModel.cs rename to BankYouBankrupt/BankYouBankruptContracts/ViewModels/Client/Reports/ReportClientCardsViewModel.cs index 7d92f4d..4b055f2 100644 --- a/BankYouBankrupt/BankYouBankruptContracts/ViewModels/ReportClientCardsViewModel.cs +++ b/BankYouBankrupt/BankYouBankruptContracts/ViewModels/Client/Reports/ReportClientCardsViewModel.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace BankYouBankruptContracts.ViewModels +namespace BankYouBankruptContracts.ViewModels.Client.Reports { public class ReportClientCardsViewModel { diff --git a/BankYouBankrupt/BankYouBankruptContracts/ViewModels/ReportClientViewModel.cs b/BankYouBankrupt/BankYouBankruptContracts/ViewModels/Client/Reports/ReportClientViewModel.cs similarity index 85% rename from BankYouBankrupt/BankYouBankruptContracts/ViewModels/ReportClientViewModel.cs rename to BankYouBankrupt/BankYouBankruptContracts/ViewModels/Client/Reports/ReportClientViewModel.cs index 82cc9cd..418a21b 100644 --- a/BankYouBankrupt/BankYouBankruptContracts/ViewModels/ReportClientViewModel.cs +++ b/BankYouBankrupt/BankYouBankruptContracts/ViewModels/Client/Reports/ReportClientViewModel.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace BankYouBankruptContracts.ViewModels +namespace BankYouBankruptContracts.ViewModels.Client.Reports { public class ReportClientViewModel { diff --git a/BankYouBankrupt/BankYouBankruptContracts/ViewModels/ClientSelectViewModel.cs b/BankYouBankrupt/BankYouBankruptContracts/ViewModels/ClientSelectViewModel.cs index 7a5af46..5ffb841 100644 --- a/BankYouBankrupt/BankYouBankruptContracts/ViewModels/ClientSelectViewModel.cs +++ b/BankYouBankrupt/BankYouBankruptContracts/ViewModels/ClientSelectViewModel.cs @@ -8,8 +8,8 @@ using System.Threading.Tasks; namespace BankYouBankruptContracts.ViewModels { - public class ClientSelectViewModel - { + public class ClientSelectViewModel + { public int Id { get; set; } public string FullName { get; set; } = string.Empty; diff --git a/BankYouBankrupt/BankYouBankruptDataModels/Enums/Months.cs b/BankYouBankrupt/BankYouBankruptDataModels/Enums/Months.cs new file mode 100644 index 0000000..c8eddb4 --- /dev/null +++ b/BankYouBankrupt/BankYouBankruptDataModels/Enums/Months.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BankYouBankruptDataModels.Enums +{ + public enum Months + { + Январь = 1, + Февраль, Март, Апрель, Май, Июнь, + Июль, Август, Сентябрь, Октябрь, Ноябрь, Декабрь + }; +} diff --git a/BankYouBankrupt/BankYouBankruptDatabaseImplement/Implements/CardStorage.cs b/BankYouBankrupt/BankYouBankruptDatabaseImplement/Implements/CardStorage.cs index d1e384d..2333ddd 100644 --- a/BankYouBankrupt/BankYouBankruptDatabaseImplement/Implements/CardStorage.cs +++ b/BankYouBankrupt/BankYouBankruptDatabaseImplement/Implements/CardStorage.cs @@ -1,7 +1,7 @@ using BankYouBankruptContracts.BindingModels; using BankYouBankruptContracts.SearchModels; using BankYouBankruptContracts.StoragesContracts; -using BankYouBankruptContracts.ViewModels; +using BankYouBankruptContracts.ViewModels.Client.Default; using BankYouBankruptDatabaseImplement.Models; using Microsoft.EntityFrameworkCore; using System; @@ -12,7 +12,7 @@ using System.Threading.Tasks; namespace BankYouBankruptDatabaseImplement.Implements { - public class CardStorage : ICardStorage + public class CardStorage : ICardStorage { public CardViewModel? Delete(CardBindingModel model) { diff --git a/BankYouBankrupt/BankYouBankruptDatabaseImplement/Implements/ClientStorage.cs b/BankYouBankrupt/BankYouBankruptDatabaseImplement/Implements/ClientStorage.cs index 2ebe4d0..d8e7d1f 100644 --- a/BankYouBankrupt/BankYouBankruptDatabaseImplement/Implements/ClientStorage.cs +++ b/BankYouBankrupt/BankYouBankruptDatabaseImplement/Implements/ClientStorage.cs @@ -1,7 +1,7 @@ using BankYouBankruptContracts.BindingModels; using BankYouBankruptContracts.SearchModels; using BankYouBankruptContracts.StoragesContracts; -using BankYouBankruptContracts.ViewModels; +using BankYouBankruptContracts.ViewModels.Client.Default; using BankYouBankruptDatabaseImplement.Models; using System; using System.Collections.Generic; @@ -11,7 +11,7 @@ using System.Threading.Tasks; namespace BankYouBankruptDatabaseImplement.Implements { - public class ClientStorage : IClientStorage + public class ClientStorage : IClientStorage { public ClientViewModel? Delete(ClientBindingModel model) { diff --git a/BankYouBankrupt/BankYouBankruptDatabaseImplement/Implements/CreditingStorage.cs b/BankYouBankrupt/BankYouBankruptDatabaseImplement/Implements/CreditingStorage.cs index a79c398..381b02c 100644 --- a/BankYouBankrupt/BankYouBankruptDatabaseImplement/Implements/CreditingStorage.cs +++ b/BankYouBankrupt/BankYouBankruptDatabaseImplement/Implements/CreditingStorage.cs @@ -1,7 +1,7 @@ using BankYouBankruptContracts.BindingModels; using BankYouBankruptContracts.SearchModels; using BankYouBankruptContracts.StoragesContracts; -using BankYouBankruptContracts.ViewModels; +using BankYouBankruptContracts.ViewModels.Client.Default; using BankYouBankruptDatabaseImplement.Models; using Microsoft.EntityFrameworkCore; using System; @@ -28,35 +28,22 @@ namespace BankYouBankruptDatabaseImplement.Implements public List GetFilteredList(CreditingSearchModel model) { using var context = new BankYouBancruptDatabase(); + var result = context.Creditings.Include(x => x.Card).ToList(); - if (model.Status.HasValue) - { - return context.Creditings - .Include(x => x.Card) - .Where(x => x.Status == model.Status) - .Select(x => x.GetViewModel) - .ToList(); - } + if (model.Status.HasValue) result = result.Where(x => x.Status == model.Status).ToList(); if (model.UserId.HasValue) { List cards = context.Cards.Where(x => x.ClientID == model.UserId).Select(x => x.Id).ToList(); - return context.Creditings.Include(x => x.Card).Where(x => cards.Contains(x.CardId)).Select(x => x.GetViewModel).ToList(); + result = result.Where(x => cards.Contains(x.CardId)).ToList(); } - if(model.DateFrom.HasValue && model.DateTo.HasValue) + if (model.DateFrom.HasValue && model.DateTo.HasValue) { - return context.Creditings - .Include(x => x.Card) - .Where(x => x.DateOpen >= model.DateFrom && x.DateClose <= model.DateTo) - .Select(x => x.GetViewModel) - .ToList(); + result = result.Where(x => x.DateOpen >= model.DateFrom && x.DateClose <= model.DateTo).ToList(); } - return context.Creditings - .Include(x => x.Card) - .Select(x => x.GetViewModel) - .ToList(); + return result.Select(x => x.GetViewModel).ToList(); } public CreditingViewModel? GetElement(CreditingSearchModel model) diff --git a/BankYouBankrupt/BankYouBankruptDatabaseImplement/Implements/DebitingStorage.cs b/BankYouBankrupt/BankYouBankruptDatabaseImplement/Implements/DebitingStorage.cs index 066112b..d4ae099 100644 --- a/BankYouBankrupt/BankYouBankruptDatabaseImplement/Implements/DebitingStorage.cs +++ b/BankYouBankrupt/BankYouBankruptDatabaseImplement/Implements/DebitingStorage.cs @@ -1,7 +1,7 @@ using BankYouBankruptContracts.BindingModels; using BankYouBankruptContracts.SearchModels; using BankYouBankruptContracts.StoragesContracts; -using BankYouBankruptContracts.ViewModels; +using BankYouBankruptContracts.ViewModels.Client.Default; using BankYouBankruptDatabaseImplement.Models; using BankYouBankruptDataModels.Enums; using Microsoft.EntityFrameworkCore; @@ -30,34 +30,23 @@ namespace BankYouBankruptDatabaseImplement.Implements { using var context = new BankYouBancruptDatabase(); + var result = context.Debitings.Include(x => x.Card).ToList(); + + //для получения всех заявок на стнятие со статусом "Открыта" - if(model.Status == StatusEnum.Открыта) - { - return context.Debitings - .Include(x => x.Card) - .Where(x => x.Status == StatusEnum.Открыта) - .Select(x => x.GetViewModel) - .ToList(); - } + if (model.Status.HasValue) result = result.Where(x => x.Status == model.Status).ToList(); if (model.UserId.HasValue) { List cards = context.Cards.Where(x => x.ClientID == model.UserId).Select(x => x.Id).ToList(); - return context.Debitings.Include(x => x.Card).Where(x => cards.Contains(x.CardId)).Select(x => x.GetViewModel).ToList(); + result = result.Where(x => cards.Contains(x.CardId)).ToList(); } if (model.DateFrom.HasValue && model.DateTo.HasValue) { - return context.Debitings - .Include(x => x.Card) - .Where(x => x.DateOpen <= model.DateFrom && x.DateClose >= model.DateTo && x.Status != StatusEnum.Отклонено) - .Select(x => x.GetViewModel) - .ToList(); - } + result = result.Where(x => x.DateOpen <= model.DateFrom && x.DateClose >= model.DateTo && x.Status != StatusEnum.Отклонено).ToList(); + } - return context.Debitings - .Include(x => x.Card) - .Select(x => x.GetViewModel) - .ToList(); + return result.Select(x => x.GetViewModel).ToList(); } public DebitingViewModel? GetElement(DebitingSearchModel model) diff --git a/BankYouBankrupt/BankYouBankruptDatabaseImplement/Models/Card.cs b/BankYouBankrupt/BankYouBankruptDatabaseImplement/Models/Card.cs index 5b14847..8280e1f 100644 --- a/BankYouBankrupt/BankYouBankruptDatabaseImplement/Models/Card.cs +++ b/BankYouBankrupt/BankYouBankruptDatabaseImplement/Models/Card.cs @@ -1,5 +1,5 @@ using BankYouBankruptContracts.BindingModels; -using BankYouBankruptContracts.ViewModels; +using BankYouBankruptContracts.ViewModels.Client.Default; using BankYouBankruptDataModels.Models; using Microsoft.EntityFrameworkCore; using System; diff --git a/BankYouBankrupt/BankYouBankruptDatabaseImplement/Models/Client.cs b/BankYouBankrupt/BankYouBankruptDatabaseImplement/Models/Client.cs index 2d48d21..40a99f7 100644 --- a/BankYouBankrupt/BankYouBankruptDatabaseImplement/Models/Client.cs +++ b/BankYouBankrupt/BankYouBankruptDatabaseImplement/Models/Client.cs @@ -1,5 +1,4 @@ using BankYouBankruptContracts.BindingModels; -using BankYouBankruptContracts.ViewModels; using BankYouBankruptDataModels.Models; using System; using System.Collections.Generic; @@ -8,6 +7,7 @@ using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text; using System.Threading.Tasks; +using BankYouBankruptContracts.ViewModels.Client.Default; namespace BankYouBankruptDatabaseImplement.Models { diff --git a/BankYouBankrupt/BankYouBankruptDatabaseImplement/Models/Crediting.cs b/BankYouBankrupt/BankYouBankruptDatabaseImplement/Models/Crediting.cs index 00f74c5..0f57947 100644 --- a/BankYouBankrupt/BankYouBankruptDatabaseImplement/Models/Crediting.cs +++ b/BankYouBankrupt/BankYouBankruptDatabaseImplement/Models/Crediting.cs @@ -1,5 +1,5 @@ using BankYouBankruptContracts.BindingModels; -using BankYouBankruptContracts.ViewModels; +using BankYouBankruptContracts.ViewModels.Client.Default; using BankYouBankruptDataModels.Enums; using BankYouBankruptDataModels.Models; using System; diff --git a/BankYouBankrupt/BankYouBankruptDatabaseImplement/Models/Debiting.cs b/BankYouBankrupt/BankYouBankruptDatabaseImplement/Models/Debiting.cs index cd606b8..b77b3c6 100644 --- a/BankYouBankrupt/BankYouBankruptDatabaseImplement/Models/Debiting.cs +++ b/BankYouBankrupt/BankYouBankruptDatabaseImplement/Models/Debiting.cs @@ -1,5 +1,5 @@ using BankYouBankruptContracts.BindingModels; -using BankYouBankruptContracts.ViewModels; +using BankYouBankruptContracts.ViewModels.Client.Default; using BankYouBankruptDataModels.Enums; using BankYouBankruptDataModels.Models; using System; diff --git a/BankYouBankrupt/BankYouBankruptRestAPI/Controllers/AccountController.cs b/BankYouBankrupt/BankYouBankruptRestAPI/Controllers/AccountController.cs index 1eaad0f..86c4d6d 100644 --- a/BankYouBankrupt/BankYouBankruptRestAPI/Controllers/AccountController.cs +++ b/BankYouBankrupt/BankYouBankruptRestAPI/Controllers/AccountController.cs @@ -3,14 +3,15 @@ using BankYouBankruptContracts.BindingModels; using BankYouBankruptContracts.BusinessLogicsContracts; using BankYouBankruptContracts.SearchModels; using BankYouBankruptContracts.ViewModels; +using BankYouBankruptContracts.ViewModels.Client.Default; using BankYouBankruptDatabaseImplement.Models; using BankYouBankruptDataModels.Enums; using Microsoft.AspNetCore.Mvc; namespace BankYouBankruptRestApi.Controllers { - //указание у контроллера, что Route будет строиться не только по наванию контроллера, но и по названию метода (так как у нас два Post-метода) - [Route("api/[controller]/[action]")] + //указание у контроллера, что Route будет строиться не только по наванию контроллера, но и по названию метода (так как у нас два Post-метода) + [Route("api/[controller]/[action]")] [ApiController] public class AccountController : Controller { diff --git a/BankYouBankrupt/BankYouBankruptRestAPI/Controllers/CardController.cs b/BankYouBankrupt/BankYouBankruptRestAPI/Controllers/CardController.cs index d8fc4a8..d60b8dc 100644 --- a/BankYouBankrupt/BankYouBankruptRestAPI/Controllers/CardController.cs +++ b/BankYouBankrupt/BankYouBankruptRestAPI/Controllers/CardController.cs @@ -1,7 +1,9 @@ -using BankYouBankruptContracts.BindingModels; +using BankYouBankruptBusinessLogic.BusinessLogics; +using BankYouBankruptContracts.BindingModels; using BankYouBankruptContracts.BusinessLogicsContracts; using BankYouBankruptContracts.SearchModels; -using BankYouBankruptContracts.ViewModels; +using BankYouBankruptContracts.ViewModels.Client.Default; +using BankYouBankruptContracts.ViewModels.Client.Diagram; using Microsoft.AspNetCore.Mvc; using System.Linq.Expressions; using System.Net; @@ -100,7 +102,7 @@ namespace BankYouBankruptRestApi.Controllers } [HttpGet] - public CardViewModel FindCard(int id) + public CardViewModel? FindCard(int id) { try { @@ -115,5 +117,19 @@ namespace BankYouBankruptRestApi.Controllers throw; } } - } + + [HttpGet] + public List getCardMonthResult(int cardId) + { + try + { + return _cardLogic.GetMonthInfo(cardId); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка получения пользователей"); + throw; + } + } + } } diff --git a/BankYouBankrupt/BankYouBankruptRestAPI/Controllers/ClientController.cs b/BankYouBankrupt/BankYouBankruptRestAPI/Controllers/ClientController.cs index 276cb7f..ca6a81a 100644 --- a/BankYouBankrupt/BankYouBankruptRestAPI/Controllers/ClientController.cs +++ b/BankYouBankrupt/BankYouBankruptRestAPI/Controllers/ClientController.cs @@ -2,8 +2,10 @@ using BankYouBankruptContracts.BindingModels; using BankYouBankruptContracts.BusinessLogicsContracts; using BankYouBankruptContracts.SearchModels; -using BankYouBankruptContracts.ViewModels; +using BankYouBankruptContracts.ViewModels.Client.Default; +using BankYouBankruptContracts.ViewModels.Client.Diagram; using DocumentFormat.OpenXml.Office2010.Excel; +using DocumentFormat.OpenXml.Spreadsheet; using Microsoft.AspNetCore.Mvc; namespace BankYouBankruptRestApi.Controllers @@ -137,5 +139,7 @@ namespace BankYouBankruptRestApi.Controllers throw; } } + + } }