2023-05-18 00:04:33 +04:00
|
|
|
|
using BankYouBankruptBusinessLogic.BusinessLogics;
|
|
|
|
|
using BankYouBankruptContracts.BindingModels;
|
|
|
|
|
using BankYouBankruptContracts.BusinessLogicsContracts;
|
|
|
|
|
using BankYouBankruptContracts.SearchModels;
|
|
|
|
|
using BankYouBankruptContracts.ViewModels;
|
|
|
|
|
using BankYouBankruptRestApi.Controllers;
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
|
|
|
|
|
namespace BankYouBankruptRestAPI.Controllers
|
|
|
|
|
{
|
|
|
|
|
//указание у контроллера, что Route будет строиться не только по наванию контроллера, но и по названию метода (так как у нас два Post-метода)
|
|
|
|
|
[Route("api/[controller]/[action]")]
|
|
|
|
|
[ApiController]
|
|
|
|
|
public class ReportController : Controller
|
|
|
|
|
{
|
|
|
|
|
private readonly ILogger _logger;
|
|
|
|
|
|
2023-05-18 02:17:27 +04:00
|
|
|
|
//private readonly IReportCashierLogic _reportCashierLogic;
|
2023-05-18 00:04:33 +04:00
|
|
|
|
|
|
|
|
|
private readonly IReportClientLogic _reportClientLogic;
|
|
|
|
|
|
2023-05-18 02:17:27 +04:00
|
|
|
|
public ReportController(ILogger<ReportController> logger, IReportClientLogic reportClientLogic)
|
2023-05-18 00:04:33 +04:00
|
|
|
|
{
|
|
|
|
|
_logger = logger;
|
|
|
|
|
_reportClientLogic = reportClientLogic;
|
2023-05-18 02:17:27 +04:00
|
|
|
|
//_reportCashierLogic = reportCashierLogic;
|
2023-05-18 00:04:33 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//метод генерации отчёта за период по картам клиента
|
2023-05-18 02:17:27 +04:00
|
|
|
|
[HttpPost]
|
|
|
|
|
public void CreateClientReport(ReportSupportBindingModel model)
|
2023-05-18 00:04:33 +04:00
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
_reportClientLogic.SaveClientReportToPdfFile(new ReportBindingModel
|
|
|
|
|
{
|
2023-05-18 11:31:42 +04:00
|
|
|
|
FileName = "Отчёт по картам за " + DateTime.Now.ToShortDateString() + ".pdf",
|
2023-05-18 02:17:27 +04:00
|
|
|
|
DateFrom = model.DateFrom,
|
|
|
|
|
DateTo = model.DateTo
|
2023-05-18 00:04:33 +04:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
_logger.LogError(ex, "Ошибка входа в систему");
|
|
|
|
|
throw;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|