35 lines
956 B
C#
35 lines
956 B
C#
using Microsoft.AspNetCore.Mvc;
|
|
using System.Diagnostics;
|
|
using WeatherDashboard.Web.Models;
|
|
using WeatherDashboard.Web.Services;
|
|
|
|
namespace WeatherDashboard.Web.Controllers
|
|
{
|
|
public class HomeController : Controller
|
|
{
|
|
private readonly IForecastService forecastService;
|
|
|
|
public HomeController(IForecastService forecastService)
|
|
{
|
|
this.forecastService = forecastService;
|
|
}
|
|
|
|
public async Task<IActionResult> Index()
|
|
{
|
|
var weather = await forecastService.GetWeatherAsync();
|
|
|
|
return View(weather);
|
|
}
|
|
|
|
public IActionResult Privacy()
|
|
{
|
|
return View();
|
|
}
|
|
|
|
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
|
public IActionResult Error()
|
|
{
|
|
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
|
|
}
|
|
}
|
|
} |