метод для почты
This commit is contained in:
parent
cfa8f74d7a
commit
4d66af0455
@ -17,6 +17,7 @@ namespace LawFirmContracts.BusinessLogicContracts
|
||||
void SaveVisitLawyerToExcelFile(ReportVisitLawyerBindingModel model);
|
||||
void SaveConsultationHearingToPdfFile(ReportConsultationHearingBindingModel model);
|
||||
void SaveCaseHearingToPdfFile(ReportCaseHearingBindingModel model);
|
||||
void SaveClientCaseHearingToPdfFile(ReportClientCaseHearingBindingModel model);
|
||||
void SaveClientsToPdfFile(ReportBindingModel model);
|
||||
}
|
||||
}
|
||||
|
@ -9,13 +9,13 @@ namespace LawFirmRestApi.Controllers
|
||||
{
|
||||
[Route("api/[controller]/[action]")]
|
||||
[ApiController]
|
||||
public class ReportClientsController : Controller
|
||||
public class ReportExecutorController : Controller
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IReportLogic _reportLogic;
|
||||
|
||||
private readonly AbstractMailWorker _mailWorker;
|
||||
public ReportClientsController(ILogger<ReportClientsController> logger, IReportLogic reportLogic, AbstractMailWorker abstractMailWorker)
|
||||
public ReportExecutorController(ILogger<ReportExecutorController> logger, IReportLogic reportLogic, AbstractMailWorker abstractMailWorker)
|
||||
{
|
||||
_logger = logger;
|
||||
_reportLogic = reportLogic;
|
||||
@ -67,21 +67,39 @@ namespace LawFirmRestApi.Controllers
|
||||
throw;
|
||||
}
|
||||
}
|
||||
//[HttpPost]
|
||||
//public void MailSend(MailSendInfoBindingModel report)
|
||||
//{
|
||||
// try
|
||||
// {
|
||||
// _mailWorker.MailSendAsync(new MailSendInfoBindingModel
|
||||
// {
|
||||
// MailAddress = report.MailAddress,
|
||||
// Subject = report.Subject,
|
||||
// Text = report.Text
|
||||
// });
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// _logger.LogError(ex, "Ошибка отправки письма");
|
||||
// throw;
|
||||
// }
|
||||
//}
|
||||
[HttpPost]
|
||||
public void MailSend(MailSendInfoBindingModel report)
|
||||
public void SendClientReportToEmail(ReportClientCaseHearingBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
_reportLogic.SaveClientCaseHearingToPdfFile(model);
|
||||
_mailWorker.MailSendAsync(new MailSendInfoBindingModel
|
||||
{
|
||||
MailAddress = report.MailAddress,
|
||||
Subject = report.Subject,
|
||||
Text = report.Text
|
||||
MailAddress = model.Email!,
|
||||
Subject = "Отчет по визитам",
|
||||
Text = "Лови"
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка отправки письма");
|
||||
throw;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user