using ComputerShopContracts.BindingModels; using ComputerShopContracts.SearchModels; using ComputerShopContracts.ViewModels; using ComputerShopBusinessLogic.BusinessLogics; using Microsoft.AspNetCore.Mvc; using ComputerShopContracts.BusinessLogicContracts; [Route("api/[controller]/[action]")] [ApiController] public class ReportController : Controller { private readonly ILogger _logger; private readonly IReportLogic _reportLogic; public ReportController(ILogger logger, IReportLogic reportLogic) { _logger = logger; _reportLogic = reportLogic; } [HttpPost] public void CreateDocReport(ReportBindingModel model) { try { _reportLogic.SaveReceivingComponentsToWordFile(model); } catch (Exception ex) { _logger.LogError(ex, "Ошибка создания отчета"); throw; } } [HttpPost] public void CreateXmlReport(ReportBindingModel model) { try { _reportLogic.SaveReceivingComponentsToXmlFile(model); } catch (Exception ex) { _logger.LogError(ex, "Ошибка создания отчета"); throw; } } [HttpPost] public void CreatePdfReport(ReportBindingModel model) { try { _reportLogic.SavePurchaseSuppliesToPdfFile(new ReportBindingModel { DateFrom = model.DateFrom, DateTo = model.DateTo, FileName = "F:\\ReportsCourseWork\\pdffile.pdf", }); } catch (Exception ex) { _logger.LogError(ex, "Ошибка создания отчета"); throw; } } }