namespace LaaProduction.Web.Controllers { using LaaProduction.Personalization; using LaaProduction.Web.App_Infrastructure; using LaaProduction.Services.Interfaces; using LaaProduction.Services.Models.Reports; using LaaProductionDI; using System; using System.Web.Mvc; [AllowedRoles(EmployeesRoles.WEB_HeReport)] public class ReportController : Controller { private readonly IReportService reportService; public ReportController() => this.reportService = LaaServiceProvider.GetService(); [HttpGet] public ActionResult Helium() { var model = this.reportService.LoadHeliumPressureReport(); return this.View(model); } [HttpPost] public ActionResult Helium(HeliumReportModel model) { model = this.reportService.LoadHeliumPressureReport(model); return this.View(model); } [HttpPost] public ActionResult HeliumCSV(HeliumReportModel model) { var csvReport = this.reportService.LoadHeliumPressureReportAsCSV(model); var fileName = $"HeReport_{DateTime.Now:yyyyMMddhhmmss}.csv"; this.Response.AddHeader("Content-Disposition", $"attachment;filename={fileName}"); return this.File(csvReport, "application/csv"); } public ActionResult HeliumResults(int testId = 0) { var results = this.reportService.LoadHeliumPressureResults(testId); return this.PartialView(results); } [HttpGet] public ActionResult Kottmann() { var model = this.reportService.LoadKottmannPressureReport(); return this.View(model); } [HttpPost] public ActionResult Kottmann(KottmannReportModel model) { model = this.reportService.LoadKottmannPressureReport(model); return this.View(model); } [HttpPost] public ActionResult KottmannCSV(KottmannReportModel model) { var csvReport = this.reportService.LoadKottmannPressureReportAsCSV(model); var fileName = $"KottmannReport_{DateTime.Now:yyyyMMddhhmmss}.csv"; this.Response.AddHeader("Content-Disposition", $"attachment;filename={fileName}"); return this.File(csvReport, "application/csv"); } [HttpGet] public ActionResult CordonelPressureSensor() { var model = this.reportService.LoadCordonelPressureSensorReport(); return this.View(model); } [HttpPost] public ActionResult CordonelPressureSensor(CordonelPressureSensorModel model) { model = this.reportService.LoadCordonelPressureSensorReport(model); return this.View(model); } } }