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" });