using Microsoft.AspNetCore.Mvc; using ReportingServices.Shared.Repositories; using ReportingServices.Shared.Models.PlanningReport; namespace ReportingServices.UI.Controllers { public class PlanningReportController : Controller { private readonly IScrapeDatabaseRepository _scrapeDatabaseRepository; public PlanningReportController(IScrapeDatabaseRepository scrapeDatabaseRepository) { _scrapeDatabaseRepository = scrapeDatabaseRepository; } public IActionResult Index() { return View(); } public IActionResult WeeklyPartChangesReport(DateTime startDate, DateTime endDate) { int numberOfPartChanges = _scrapeDatabaseRepository.GetNumberOfPartChanges(startDate.ToString(), endDate.ToString()); List reactorPSNWORuns = _scrapeDatabaseRepository.GetReactorPSNWORuns(startDate.ToString(), endDate.ToString()); WeeklyPartChanges weeklyPartChanges = new() { TotalPartChanges = numberOfPartChanges, StartDate = startDate.ToShortDateString(), EndDate = endDate.ToShortDateString(), ReactorPSNWORuns = reactorPSNWORuns }; return View(weeklyPartChanges); } } }