using Microsoft.AspNetCore.Mvc; using ReportingServices.Shared.Models.PlanningReport; using ReportingServices.Shared.HelperClasses; namespace ReportingServices.UI.Controllers { public class PlanningReportController : Controller { private readonly IConfiguration _configuration; private readonly string _baseUrl; public PlanningReportController(IConfiguration configuration) { _configuration = configuration; _baseUrl = _configuration.GetValue("BaseAPIAddress") + "ScrapeDB/"; } public IActionResult Index() { return View(); } public async Task WeeklyPartChangesReport(DateTime startDate, DateTime endDate) { string partChangeUrl = _baseUrl + "PartChanges?startDate=" + startDate.ToString() + "&endDate=" + endDate.ToString(); string psnwoRunsUrl = _baseUrl + "PSNWO?startDate=" + startDate.ToString() + "&endDate=" + endDate.ToString(); int numberOfPartChanges = await ApiCaller.GetApi(partChangeUrl); List reactorPSNWORuns = await ApiCaller.GetApi>(psnwoRunsUrl); WeeklyPartChanges weeklyPartChanges = new() { TotalPartChanges = numberOfPartChanges, StartDate = startDate.ToShortDateString(), EndDate = endDate.ToShortDateString(), ReactorPSNWORuns = reactorPSNWORuns }; return View(weeklyPartChanges); } } }