| | 1 | | using Microsoft.AspNetCore.Mvc; |
| | 2 | | using ReportingServices.Shared.Models.PlanningReport; |
| | 3 | | using ReportingServices.Shared.HelperClasses; |
| | 4 | |
|
| | 5 | | namespace ReportingServices.UI.Controllers |
| | 6 | | { |
| | 7 | | public class PlanningReportController : Controller |
| | 8 | | { |
| 0 | 9 | | private readonly string _baseUrl = "https://localhost:7196/api/ScrapeDB/"; |
| | 10 | |
|
| | 11 | | public IActionResult Index() |
| 0 | 12 | | { |
| 0 | 13 | | return View(); |
| 0 | 14 | | } |
| | 15 | |
|
| | 16 | | public async Task<IActionResult> WeeklyPartChangesReport(DateTime startDate, DateTime endDate) |
| 0 | 17 | | { |
| 0 | 18 | | string partChangeUrl = _baseUrl + "PartChanges?startDate=" + startDate.ToString() + "&endDate=" + endDate.To |
| 0 | 19 | | string psnwoRunsUrl = _baseUrl + "PSNWO?startDate=" + startDate.ToString() + "&endDate=" + endDate.ToString( |
| | 20 | |
|
| 0 | 21 | | int numberOfPartChanges = await ApiCaller.GetApi<int>(partChangeUrl); |
| 0 | 22 | | List<ReactorPSNWORuns> reactorPSNWORuns = await ApiCaller.GetApi<List<ReactorPSNWORuns>>(psnwoRunsUrl); |
| | 23 | |
|
| 0 | 24 | | WeeklyPartChanges weeklyPartChanges = new() |
| 0 | 25 | | { |
| 0 | 26 | | TotalPartChanges = numberOfPartChanges, |
| 0 | 27 | | StartDate = startDate.ToShortDateString(), |
| 0 | 28 | | EndDate = endDate.ToShortDateString(), |
| 0 | 29 | | ReactorPSNWORuns = reactorPSNWORuns |
| 0 | 30 | | }; |
| | 31 | |
|
| 0 | 32 | | return View(weeklyPartChanges); |
| 0 | 33 | | } |
| | 34 | | } |
| | 35 | | } |