50 lines
1.6 KiB
C#
50 lines
1.6 KiB
C#
|
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;
|
|||
|
|
|||
|
private readonly IReportCashierLogic _reportCashierLogic;
|
|||
|
|
|||
|
private readonly IReportClientLogic _reportClientLogic;
|
|||
|
|
|||
|
public ReportController(ILogger<AccountController> logger, IReportClientLogic reportClientLogic, IReportCashierLogic reportCashierLogic)
|
|||
|
{
|
|||
|
_logger = logger;
|
|||
|
_reportClientLogic = reportClientLogic;
|
|||
|
_reportCashierLogic = reportCashierLogic;
|
|||
|
}
|
|||
|
|
|||
|
//метод генерации отчёта за период по картам клиента
|
|||
|
[HttpGet]
|
|||
|
public void CreateClientReport(DateTime DateFrom, DateTime DateTo)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
_reportClientLogic.SaveClientReportToPdfFile(new ReportBindingModel
|
|||
|
{
|
|||
|
FileName = "Отчёт по картам от " + DateTime.Now.ToShortDateString(),
|
|||
|
DateFrom = DateFrom,
|
|||
|
DateTo = DateTo
|
|||
|
});
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
_logger.LogError(ex, "Ошибка входа в систему");
|
|||
|
throw;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|