public IHttpActionResult SendPatientInvoicesToEmail(PatientInvoicesReportDto patientInvoicesReportDto) { _patientService.SendInvoicesToEmail(new PatientInvoicesReportDto { DocumentType = patientInvoicesReportDto.DocumentType, EndDate = patientInvoicesReportDto.EndDate, PatientId = patientInvoicesReportDto.PatientId, StartDate = patientInvoicesReportDto.StartDate }); return(Ok(new ResponseModel("Отчет отправлен успешно!"))); }
public void SendInvoicesToEmail(PatientInvoicesReportDto patientInvoicesReportDto) { var title = $"Счета за период с {patientInvoicesReportDto.StartDate.Date} по {patientInvoicesReportDto.EndDate.Date}"; const string message = "Привет! Вам пришел счет!"; var invoices = GetUnpaidInvoices(patientInvoicesReportDto.PatientId); var invoicesDocument = new PatientInvoicesDocument("Отчет " + DateTime.Now.Date + ".docx", invoices); var invoicesWorkbook = new PatientInvoicesWorkbook("Отчет " + DateTime.Now.Date + ".xlsx", invoices); _mailService.SendFilesToPatient(patientInvoicesReportDto.PatientId, title, message, new List <ExportedFile> { invoicesDocument, invoicesWorkbook }); }