From 79cc787ebf44c64268056a1e0deb60233fee282e Mon Sep 17 00:00:00 2001 From: Programmist73 Date: Fri, 19 May 2023 02:18:52 +0400 Subject: [PATCH] =?UTF-8?q?=D0=93=D0=BE=D1=82=D0=BE=D0=B2=D1=8B=D0=B9=20?= =?UTF-8?q?=D0=BE=D1=82=D1=87=D1=91=D1=82=20=D0=B4=D0=BB=D1=8F=20=D0=BA?= =?UTF-8?q?=D0=BB=D0=B8=D0=B5=D0=BD=D1=82=D0=B0.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BankYouBankruptClientApp/APIClient.cs | 22 +++++++++++++++++- .../Controllers/HomeController.cs | 12 ++++------ .../Controllers/ReportController.cs | 6 +++-- .../Отчёт_по_картам.pdf | Bin 34882 -> 35597 bytes 4 files changed, 29 insertions(+), 11 deletions(-) diff --git a/BankYouBankrupt/BankYouBankruptClientApp/APIClient.cs b/BankYouBankrupt/BankYouBankruptClientApp/APIClient.cs index e05164d..06bf9e6 100644 --- a/BankYouBankrupt/BankYouBankruptClientApp/APIClient.cs +++ b/BankYouBankrupt/BankYouBankruptClientApp/APIClient.cs @@ -50,5 +50,25 @@ namespace BankYouBankruptСlientApp throw new Exception(result); } } - } + + //Post-запрос для получения данных + public static T? PostRequestReport(string requestUrl, U model) + { + var json = JsonConvert.SerializeObject(model); + var data = new StringContent(json, Encoding.UTF8, "application/json"); + + var response = _client.PostAsync(requestUrl, data); + + var result = response.Result.Content.ReadAsStringAsync().Result; + + if (response.Result.IsSuccessStatusCode) + { + return JsonConvert.DeserializeObject(result); + } + else + { + throw new Exception(result); + } + } + } } diff --git a/BankYouBankrupt/BankYouBankruptClientApp/Controllers/HomeController.cs b/BankYouBankrupt/BankYouBankruptClientApp/Controllers/HomeController.cs index 8a6aef4..9a6829f 100644 --- a/BankYouBankrupt/BankYouBankruptClientApp/Controllers/HomeController.cs +++ b/BankYouBankrupt/BankYouBankruptClientApp/Controllers/HomeController.cs @@ -253,8 +253,6 @@ namespace BankYouBankruptClientApp.Controllers return Redirect("~/Home/Enter"); } - ViewBag.DataOfClientReport = null; - return View(); } @@ -266,15 +264,13 @@ namespace BankYouBankruptClientApp.Controllers throw new Exception("Не авторизованы"); } - APIClient.PostRequest("api/Report/CreateClientReport", new ReportSupportBindingModel() + //ViewBag.DataOfClientReport = APIClient.GetRequest($"api/Report/GetDataOfClientReport"); + + return View(APIClient.PostRequestReport("api/Report/CreateClientReport", new ReportSupportBindingModel() { DateFrom = dateFrom, DateTo = dateTo - }); - - ViewBag.DataOfClientReport = APIClient.GetRequest($"api/Report/GetDataOfClientReport"); - - return View(); + })); } #endregion diff --git a/BankYouBankrupt/BankYouBankruptRestAPI/Controllers/ReportController.cs b/BankYouBankrupt/BankYouBankruptRestAPI/Controllers/ReportController.cs index fbff12f..470b835 100644 --- a/BankYouBankrupt/BankYouBankruptRestAPI/Controllers/ReportController.cs +++ b/BankYouBankrupt/BankYouBankruptRestAPI/Controllers/ReportController.cs @@ -36,16 +36,18 @@ namespace BankYouBankruptRestAPI.Controllers //метод генерации отчёта за период по картам клиента [HttpPost] - public void CreateClientReport(ReportSupportBindingModel model) + public ReportClientViewModelForHTML CreateClientReport(ReportSupportBindingModel model) { try { - _reportClientViewModelForHTML = _reportClientLogic.SaveClientReportToPdfFile(new ReportBindingModel + var result = _reportClientLogic.SaveClientReportToPdfFile(new ReportBindingModel { FileName = "Отчёт_по_картам.pdf", DateFrom = model.DateFrom, DateTo = model.DateTo }); + + return result; } catch (Exception ex) { diff --git a/BankYouBankrupt/BankYouBankruptRestAPI/Отчёт_по_картам.pdf b/BankYouBankrupt/BankYouBankruptRestAPI/Отчёт_по_картам.pdf index 818a3b90ec6cdf7fe4cd94e99887688c17ae58b7..13f6aadc0babaae5f4ae3c8aec5d8f718ced7152 100644 GIT binary patch delta 3114 zcmai#c|6oxAIBN8r?Hf7S>}p12D366G8);VNTx!}BI{U2S>o3up{}h-%+Q!DSz^i( zLqrmT>N?S^UWFC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