mirror of
https://github.com/alexhopeoconnor/bom-local-service.git
synced 2026-10-03 21:21:59 +10:00
- Add MVC test page at /radar/{suburb}/{state} demonstrating API usage
- Implement auto-play on page load with cookie-based settings
- Add connection monitoring with automatic retry on API downtime
- Show update status, cache state, and next check times
- Fix NextUpdateTime calculation to account for background service intervals
- Add graceful error handling and visual status indicators
34 lines
972 B
C#
34 lines
972 B
C#
using BomLocalService.Utilities;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
namespace BomLocalService.Controllers;
|
|
|
|
/// <summary>
|
|
/// MVC controller for serving the radar test/demo page.
|
|
/// This demonstrates best practices for consuming the radar API.
|
|
/// </summary>
|
|
[Route("radar")]
|
|
public class RadarTestController : Controller
|
|
{
|
|
/// <summary>
|
|
/// Serves the test page for viewing radar data for a specific location.
|
|
/// Route: /radar/{suburb}/{state}
|
|
/// </summary>
|
|
[HttpGet("{suburb}/{state}")]
|
|
public IActionResult Index(string suburb, string state)
|
|
{
|
|
var validationError = ValidationHelper.ValidateLocation(suburb, state);
|
|
if (validationError != null)
|
|
{
|
|
return BadRequest(validationError);
|
|
}
|
|
|
|
ViewBag.Suburb = suburb;
|
|
ViewBag.State = state;
|
|
ViewBag.ApiBaseUrl = $"/api/radar/{Uri.EscapeDataString(suburb)}/{Uri.EscapeDataString(state)}";
|
|
|
|
return View();
|
|
}
|
|
}
|
|
|