2023-02-09 02:30:14 +00:00
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
2023-02-10 03:33:02 +00:00
|
|
|
|
using WeatherDashboard.Web.Services;
|
2023-02-09 02:30:14 +00:00
|
|
|
|
|
|
|
|
|
namespace WeatherDashboard.Web.Controllers
|
|
|
|
|
{
|
|
|
|
|
public class HomeController : Controller
|
|
|
|
|
{
|
2023-02-10 03:33:02 +00:00
|
|
|
|
private readonly IForecastService forecastService;
|
2023-02-09 02:30:14 +00:00
|
|
|
|
|
2023-02-10 03:33:02 +00:00
|
|
|
|
public HomeController(IForecastService forecastService)
|
2023-02-09 02:30:14 +00:00
|
|
|
|
{
|
2023-02-10 03:33:02 +00:00
|
|
|
|
this.forecastService = forecastService;
|
2023-02-09 02:30:14 +00:00
|
|
|
|
}
|
|
|
|
|
|
2023-02-10 03:33:02 +00:00
|
|
|
|
public async Task<IActionResult> Index()
|
2023-02-09 02:30:14 +00:00
|
|
|
|
{
|
2023-02-10 03:33:02 +00:00
|
|
|
|
var weather = await forecastService.GetWeatherAsync();
|
|
|
|
|
|
|
|
|
|
return View(weather);
|
2023-02-09 02:30:14 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|