WeatherDashboard/WeatherDashboard.Web/Views/Home/Index.cshtml

50 lines
1.5 KiB
Plaintext
Raw Normal View History

2023-02-10 03:33:02 +00:00
@model WeatherSet
@{
2023-02-09 02:30:14 +00:00
ViewData["Title"] = "Home Page";
}
2023-02-16 15:06:43 +00:00
<div class="location">
2023-03-18 17:37:48 +00:00
@*<div>@Model.Location.Name, @Model.Location.Region</div>*@
2023-02-16 15:06:43 +00:00
<small>Last updated on @Model.Current.LastUpdated</small>
2023-02-10 03:33:02 +00:00
</div>
2023-02-16 15:06:43 +00:00
<div class="current-conditions">
<div class="current-condition-name">@Model.Current.ConditionName</div>
2023-02-23 15:44:52 +00:00
<div class="current-temperature">@Model.Current.Temperature<span class="degrees">&#176;F</span></div>
2023-02-09 02:30:14 +00:00
</div>
2023-02-23 15:44:52 +00:00
2023-03-18 15:16:24 +00:00
<div class="detailed-conditions">
@foreach (var forecast in Model.Forecast)
{
2023-03-18 17:30:55 +00:00
var displayHours = new Dictionary<int, string>
{
[6] = "Morning",
[12] = "Noon",
[17] = "Evening",
[22] = "Night"
};
2023-03-18 15:33:19 +00:00
var hourForecasts = forecast.HourForecasts
2023-03-18 17:30:55 +00:00
.Join(displayHours, f => f.Time.Value.Hour, d => d.Key, (f, d) => new
{
TimeOfDay = d.Value,
Forecast = f
})
2023-03-18 15:33:19 +00:00
.ToList();
2023-03-18 15:16:24 +00:00
<div class="row day-summary">
<div class="col col-6">@forecast.Summary.ConditionName</div>
<div class="col col-6">@forecast.Summary.HighTemp / @forecast.Summary.LowTemp</div>
</div>
2023-03-18 15:33:19 +00:00
@foreach (var hourForecast in hourForecasts)
2023-03-18 15:16:24 +00:00
{
<div class="row day-detail">
2023-03-18 17:30:55 +00:00
<div class="col">@hourForecast.TimeOfDay</div>
<div class="col">@hourForecast.Forecast.ConditionName / @hourForecast.Forecast.Temperature</div>
2023-03-18 15:16:24 +00:00
</div>
}
}
</div>