Initial commit
This commit is contained in:
42
Oqtane.Client/Modules/Weather/Index.razor
Normal file
42
Oqtane.Client/Modules/Weather/Index.razor
Normal file
@ -0,0 +1,42 @@
|
||||
@using Oqtane.Modules
|
||||
@using Oqtane.Client.Modules.Weather.Services
|
||||
@inherits ModuleBase
|
||||
|
||||
@if (forecasts == null)
|
||||
{
|
||||
<p><em>Loading...</em></p>
|
||||
}
|
||||
else
|
||||
{
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th>Temp. (C)</th>
|
||||
<th>Temp. (F)</th>
|
||||
<th>Summary</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var forecast in forecasts)
|
||||
{
|
||||
<tr>
|
||||
<td>@forecast.Date.ToShortDateString()</td>
|
||||
<td>@forecast.TemperatureC</td>
|
||||
<td>@forecast.TemperatureF</td>
|
||||
<td>@forecast.Summary</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
|
||||
@functions {
|
||||
WeatherForecast[] forecasts;
|
||||
|
||||
protected override async Task OnInitAsync()
|
||||
{
|
||||
WeatherForecastService forecastservice = new WeatherForecastService();
|
||||
forecasts = await forecastservice.GetForecastAsync(DateTime.Now);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user