Skip to content

Commit 4bc47f9

Browse files
committed
Remove unwanted sample changes
1 parent 90d25f9 commit 4bc47f9

File tree

6 files changed

+41
-213
lines changed

6 files changed

+41
-213
lines changed

src/Components/Samples/BlazorUnitedApp.Client/Data/WeatherForecast.cs

Lines changed: 0 additions & 15 deletions
This file was deleted.

src/Components/Samples/BlazorUnitedApp.Client/Data/WeatherForecastService.cs

Lines changed: 0 additions & 23 deletions
This file was deleted.

src/Components/Samples/BlazorUnitedApp.Client/Pages/ClientFetchData.razor

Lines changed: 0 additions & 80 deletions
This file was deleted.

src/Components/Samples/BlazorUnitedApp/Data/WeatherForecastService.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,13 @@ public class WeatherForecastService
1010
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
1111
};
1212

13-
public async Task<WeatherForecast[]> GetForecastAsync(DateOnly startDate)
13+
public Task<WeatherForecast[]> GetForecastAsync(DateOnly startDate)
1414
{
15-
await Task.Delay(1000);
16-
return [.. Enumerable.Range(1, 5).Select(index => new WeatherForecast
15+
return Task.FromResult(Enumerable.Range(1, 5).Select(index => new WeatherForecast
1716
{
1817
Date = startDate.AddDays(index),
1918
TemperatureC = Random.Shared.Next(-20, 55),
2019
Summary = Summaries[Random.Shared.Next(Summaries.Length)]
21-
})];
20+
}).ToArray());
2221
}
2322
}

src/Components/Samples/BlazorUnitedApp/Pages/FetchData.razor

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,46 @@
22
@using BlazorUnitedApp.Data
33
@inject WeatherForecastService ForecastService
44

5-
<FetchDataChildren @rendermode="InteractiveServer" YayOrNay="@YayOrNay"></FetchDataChildren>
5+
<PageTitle>Weather forecast</PageTitle>
6+
7+
<h1>Weather forecast</h1>
8+
9+
<p>This component demonstrates fetching data from a service.</p>
10+
11+
@if (forecasts == null)
12+
{
13+
<p><em>Loading...</em></p>
14+
}
15+
else
16+
{
17+
<table class="table">
18+
<thead>
19+
<tr>
20+
<th>Date</th>
21+
<th>Temp. (C)</th>
22+
<th>Temp. (F)</th>
23+
<th>Summary</th>
24+
</tr>
25+
</thead>
26+
<tbody>
27+
@foreach (var forecast in forecasts)
28+
{
29+
<tr>
30+
<td>@forecast.Date.ToShortDateString()</td>
31+
<td>@forecast.TemperatureC</td>
32+
<td>@forecast.TemperatureF</td>
33+
<td>@forecast.Summary</td>
34+
</tr>
35+
}
36+
</tbody>
37+
</table>
38+
}
39+
640
@code {
7-
[CascadingParameter] public HttpContext Context { get; set; } = null!;
41+
private WeatherForecast[]? forecasts;
842

9-
protected override void OnInitialized()
43+
protected override async Task OnInitializedAsync()
1044
{
11-
YayOrNay = Context.Request.Query["YayOrNay"] == "true" ? true : false;
45+
forecasts = await ForecastService.GetForecastAsync(DateOnly.FromDateTime(DateTime.Now));
1246
}
13-
14-
public bool YayOrNay { get; set; } = false;
1547
}

src/Components/Samples/BlazorUnitedApp/Pages/FetchDataChildren.razor

Lines changed: 0 additions & 85 deletions
This file was deleted.

0 commit comments

Comments
 (0)