From 06c59932ca296152c6dc622804f90cbe244205f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=98=D0=BB=D1=8C=D1=8F=20=D0=A4=D0=B5=D0=B4=D0=BE=D1=82?= =?UTF-8?q?=D0=BE=D0=B2?= Date: Sun, 2 Jun 2024 09:03:59 +0400 Subject: [PATCH] GetReport --- .../ViewModels/ReportPaymeantsViewModel.cs | 2 +- .../ElectronicsShopDataModels/Models/IPaymentModel.cs | 1 + .../Controllers/ClientController.cs | 11 +++++++++-- .../Controllers/HomeController.cs | 8 +++++++- .../Views/Home/Report.cshtml | 6 +++--- 5 files changed, 21 insertions(+), 7 deletions(-) diff --git a/ElectronicsShop/ElectronicsShopContracts/ViewModels/ReportPaymeantsViewModel.cs b/ElectronicsShop/ElectronicsShopContracts/ViewModels/ReportPaymeantsViewModel.cs index c60a12c..da5c9cd 100644 --- a/ElectronicsShop/ElectronicsShopContracts/ViewModels/ReportPaymeantsViewModel.cs +++ b/ElectronicsShop/ElectronicsShopContracts/ViewModels/ReportPaymeantsViewModel.cs @@ -15,6 +15,6 @@ namespace ElectronicsShopContracts.ViewModels public int OrderID { get; set; } public double SumPayment { get; set; } - public PaymeantOption PayOption { get; set; } = PaymeantOption.Неоплачено; + public PaymeantOption PayOption { get; set; } } } diff --git a/ElectronicsShop/ElectronicsShopDataModels/Models/IPaymentModel.cs b/ElectronicsShop/ElectronicsShopDataModels/Models/IPaymentModel.cs index 1170593..3e31d6b 100644 --- a/ElectronicsShop/ElectronicsShopDataModels/Models/IPaymentModel.cs +++ b/ElectronicsShop/ElectronicsShopDataModels/Models/IPaymentModel.cs @@ -13,6 +13,7 @@ namespace ElectronicsShopDataModels.Models int OrderID { get; } double SumPayment { get; } PaymeantOption PayOption { get; } + DateTime DatePaymeant { get; } int ClientID { get; } } } diff --git a/ElectronicsShop/ElectronicsShopRestAPI/Controllers/ClientController.cs b/ElectronicsShop/ElectronicsShopRestAPI/Controllers/ClientController.cs index 665dbe2..3812ef7 100644 --- a/ElectronicsShop/ElectronicsShopRestAPI/Controllers/ClientController.cs +++ b/ElectronicsShop/ElectronicsShopRestAPI/Controllers/ClientController.cs @@ -14,11 +14,13 @@ namespace ElectronicsShopRestAPI.Controllers { private readonly ILogger _logger; private readonly IClientLogic _logic; private readonly IPaymeantLogic _payLogic; + private readonly IReportClientLogic _reportLogic; - public ClientController(ILogger logger, IClientLogic logic, IPaymeantLogic payLogic) { + public ClientController(ILogger logger, IClientLogic logic, IPaymeantLogic payLogic, IReportClientLogic reportlogic) { _logger = logger; _logic = logic; _payLogic = payLogic; + _reportLogic = reportlogic; } [HttpGet] @@ -76,5 +78,10 @@ namespace ElectronicsShopRestAPI.Controllers { throw; } } - } + [HttpPost] + public List? GetReport(DateTime _start, DateTime _end) { + var dataSource = _reportLogic.GetPaymeants(new ReportBindingModel { }); + return dataSource; + } + } } diff --git a/ElectronicsShop/ElectronicsShopShopClientApp/Controllers/HomeController.cs b/ElectronicsShop/ElectronicsShopShopClientApp/Controllers/HomeController.cs index a201c50..729af30 100644 --- a/ElectronicsShop/ElectronicsShopShopClientApp/Controllers/HomeController.cs +++ b/ElectronicsShop/ElectronicsShopShopClientApp/Controllers/HomeController.cs @@ -292,5 +292,11 @@ namespace ElectronicsShopUserApp.Controllers { var _product = APIClient.GetRequset($"api/main/getproduct?_productid={product}"); return count * (_product?.Price ?? 1); } - } + + [HttpGet] + public IActionResult ReportMake(DateTime startDate, DateTime endDate) { + var _report = APIClient.GetRequset>($"api/main/getreport?_start={startDate}&_end={endDate}"); + return View(_report); + } + } } diff --git a/ElectronicsShop/ElectronicsShopShopClientApp/Views/Home/Report.cshtml b/ElectronicsShop/ElectronicsShopShopClientApp/Views/Home/Report.cshtml index de5ba1e..88841e1 100644 --- a/ElectronicsShop/ElectronicsShopShopClientApp/Views/Home/Report.cshtml +++ b/ElectronicsShop/ElectronicsShopShopClientApp/Views/Home/Report.cshtml @@ -20,13 +20,13 @@