using Microsoft.AspNetCore.Mvc; using PolyclinicContracts.BusinessLogicsContracts; using PolyclinicContracts.ViewModels; using PolyclinicWebAppImplementer.Models; namespace PolyclinicWebAppImplementer.Controllers { public class ReportsController : Controller { private readonly IImplementerReportLogic _reportLogic; private readonly IDiagnoseLogic _diagnoseLogic; public ReportsController(IImplementerReportLogic reportLogic, IDiagnoseLogic diagnoseLogic) { _reportLogic = reportLogic; _diagnoseLogic = diagnoseLogic; } [HttpGet] [HttpPost] public IActionResult DiagnosesByPeriod(DiagnosesByPeriodFormModel model) { var currentUser = LoginManager.LogginedUser; if (currentUser == null) { return RedirectToAction("Login", "User"); } if (HttpContext.Request.Method == "GET") { return View(model); } else { model.Report = _reportLogic.GetReportDiagnosesByPeriod(model.DateStart, model.DateEnd); return View(model); } } [HttpGet] [HttpPost] public IActionResult MedicamentsByDiagnoses(MedicamentsByDiagnosesFormModel model) { var currentUser = LoginManager.LogginedUser; if (currentUser == null) { return RedirectToAction("Login", "User"); } if (HttpContext.Request.Method == "GET") { return View(model); } else { return View(model); } } } }