84 lines
2.4 KiB
C#
84 lines
2.4 KiB
C#
using HospitalContracts.BindingModels;
|
|
using HospitalContracts.BusinessLogicsContracts;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
namespace HospitalRestApi.Controllers
|
|
{
|
|
[Route("api/[controller]/[action]")]
|
|
[ApiController]
|
|
public class ReportController : Controller
|
|
{
|
|
private readonly ILogger _logger;
|
|
private readonly IReportLogic _reportLogic;
|
|
//private readonly AbstractMailWorker _mailWorker;
|
|
public ReportController(ILogger<ReportController> logger, IReportLogic reportLogic)
|
|
{
|
|
_logger = logger;
|
|
_reportLogic = reportLogic;
|
|
//_mailWorker = mailWorker;
|
|
}
|
|
|
|
//[HttpPost]
|
|
//public void CreateReportToPdfFile(ReportBindingModel model)
|
|
//{
|
|
// try
|
|
// {
|
|
// _reportLogic.SaveMedicinesToPdfFile(new ReportBindingModel
|
|
// {
|
|
// DateFrom = model.DateFrom,
|
|
// DateTo = model.DateTo,
|
|
// OrganiserId = model.OrganiserId,
|
|
// FileName = "C:\\ReportsCourseWork\\pdffile.pdf",
|
|
// });
|
|
// }
|
|
// catch (Exception ex)
|
|
// {
|
|
// _logger.LogError(ex, "Ошибка создания отчета");
|
|
// throw;
|
|
// }
|
|
//}
|
|
|
|
//[HttpPost]
|
|
//public void SendPdfToMail(MailSendInfoBindingModel model)
|
|
//{
|
|
// try
|
|
// {
|
|
// _mailWorker.MailSendAsync(model);
|
|
// }
|
|
// catch (Exception ex)
|
|
// {
|
|
// _logger.LogError(ex, "Ошибка отправки письма");
|
|
// throw;
|
|
// }
|
|
//}
|
|
|
|
[HttpPost]
|
|
public void CreateReportToWordFile(ReportBindingModel model)
|
|
{
|
|
try
|
|
{
|
|
_reportLogic.SaveMedicinesToWordFile(model);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
_logger.LogError(ex, "Ошибка создания отчета");
|
|
throw;
|
|
}
|
|
}
|
|
|
|
[HttpPost]
|
|
public void CreateReportToExcelFile(ReportBindingModel model)
|
|
{
|
|
try
|
|
{
|
|
_reportLogic.SaveMedicinesToExcelFile(model);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
_logger.LogError(ex, "Ошибка создания отчета");
|
|
throw;
|
|
}
|
|
}
|
|
}
|
|
}
|