43 lines
1.5 KiB
C#
43 lines
1.5 KiB
C#
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<string>("BaseAPIAddress") + "ScrapeDB/";
|
|
}
|
|
|
|
public IActionResult Index()
|
|
{
|
|
return View();
|
|
}
|
|
|
|
public async Task<IActionResult> 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<int>(partChangeUrl);
|
|
List<ReactorPSNWORuns> reactorPSNWORuns = await ApiCaller.GetApi<List<ReactorPSNWORuns>>(psnwoRunsUrl);
|
|
|
|
WeeklyPartChanges weeklyPartChanges = new()
|
|
{
|
|
TotalPartChanges = numberOfPartChanges,
|
|
StartDate = startDate.ToShortDateString(),
|
|
EndDate = endDate.ToShortDateString(),
|
|
ReactorPSNWORuns = reactorPSNWORuns
|
|
};
|
|
|
|
return View(weeklyPartChanges);
|
|
}
|
|
}
|
|
}
|