From 7755e3d4829dfaf0feac151c4a9583a89d2e2cf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=BB=D0=B0=D0=B4=D0=B8=D0=BC=D0=B8=D1=80=20=D0=94?= =?UTF-8?q?=D0=B0=D0=BD=D0=B8=D0=BB=D0=BE=D0=B2?= Date: Thu, 30 May 2024 02:53:25 +0400 Subject: [PATCH] =?UTF-8?q?=D0=A2=D0=B0=D0=BA=20=D0=B1=D1=83=D0=B4=D0=B5?= =?UTF-8?q?=D1=82=20=D0=BB=D1=83=D1=87=D1=88=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/HomeController.cs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/VeterinaryClinic/VeterinaryClinicWebApp/Controllers/HomeController.cs b/VeterinaryClinic/VeterinaryClinicWebApp/Controllers/HomeController.cs index c4b8c5a..22c2702 100644 --- a/VeterinaryClinic/VeterinaryClinicWebApp/Controllers/HomeController.cs +++ b/VeterinaryClinic/VeterinaryClinicWebApp/Controllers/HomeController.cs @@ -289,18 +289,31 @@ public class HomeController : Controller /// Отправить по почте отчёт /// [HttpPost] - public void SendReport() + public void SendReport(DateTime dateFrom, DateTime dateTo) { if (APIClient.User == null) { throw new Exception("Необходимо авторизоваться!"); } + if (dateFrom == DateTime.MinValue || dateTo == DateTime.MinValue) + { + throw new Exception("Введены не все данные!"); + } + + _reportLogic.SaveVisitsInfoToPdfFile(new ReportBindingModel + { + FileName = $@"D:\report.pdf", + UserId = APIClient.User.Id, + DateFrom = dateFrom, + DateTo = dateTo + }); + _mailLogic.MailSendAsync(new MailSendInfoBindingModel { MailAddress = APIClient.User.Email, Subject = $"Отчет {APIClient.User.FullName}", - Text = "Ваш отчет", + Text = $@"Ваш отчет с {dateFrom} по {dateTo}", Path = "D:\\report.pdf" });