Continous Integration in der Praxis Gruppenarbeit
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1.0 KiB

3 years ago
  1. @page "/fetchdata"
  2. @using BlazorMiniGames.Shared
  3. @inject HttpClient Http
  4. <h1>Weather forecast</h1>
  5. <p>This component demonstrates fetching data from the server.</p>
  6. @if (forecasts == null)
  7. {
  8. <p><em>Loading...</em></p>
  9. }
  10. else
  11. {
  12. <table class="table">
  13. <thead>
  14. <tr>
  15. <th>Date</th>
  16. <th>Temp. (C)</th>
  17. <th>Temp. (F)</th>
  18. <th>Summary</th>
  19. </tr>
  20. </thead>
  21. <tbody>
  22. @foreach (var forecast in forecasts)
  23. {
  24. <tr>
  25. <td>@forecast.Date.ToShortDateString()</td>
  26. <td>@forecast.TemperatureC</td>
  27. <td>@forecast.TemperatureF</td>
  28. <td>@forecast.Summary</td>
  29. </tr>
  30. }
  31. </tbody>
  32. </table>
  33. }
  34. @code {
  35. private WeatherForecast[] forecasts;
  36. protected override async Task OnInitializedAsync()
  37. {
  38. forecasts = await Http.GetFromJsonAsync<WeatherForecast[]>("WeatherForecast");
  39. }
  40. }