CourseWork_BankYouBankrupt/BankYouBankrupt/BankYouBankruptRestAPI/Controllers/ReportController.cs

50 lines
1.6 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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;
}
}
}
}