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.
		
		
		
		
		
			
		
			
				
					
					
						
							43 lines
						
					
					
						
							1.7 KiB
						
					
					
				
			
		
		
	
	
							43 lines
						
					
					
						
							1.7 KiB
						
					
					
				@page "/fetchdata"
 | 
						|
@using TestApp02.Data
 | 
						|
@inject WeatherForecastService ForecastService
 | 
						|
 | 
						|
<PageTitle>Weather forecast</PageTitle>
 | 
						|
 | 
						|
<MudText Typo="Typo.h3" GutterBottom="true">Weather forecast</MudText>
 | 
						|
<MudText Class="mb-8">This component demonstrates fetching data from the server.</MudText>
 | 
						|
@if (forecasts == null)
 | 
						|
{
 | 
						|
    <MudProgressCircular Color="Color.Default" Indeterminate="true" />
 | 
						|
}
 | 
						|
else
 | 
						|
{
 | 
						|
    <MudTable Items="forecasts" Hover="true" SortLabel="Sort By" Elevation="0">
 | 
						|
        <HeaderContent>
 | 
						|
            <MudTh><MudTableSortLabel InitialDirection="SortDirection.Ascending" SortBy="new Func<WeatherForecast, object>(x=>x.Date)">Date</MudTableSortLabel></MudTh>
 | 
						|
            <MudTh><MudTableSortLabel SortBy="new Func<WeatherForecast, object>(x=>x.TemperatureC)">Temp. (C)</MudTableSortLabel></MudTh>
 | 
						|
            <MudTh><MudTableSortLabel SortBy="new Func<WeatherForecast, object>(x=>x.TemperatureF)">Temp. (F)</MudTableSortLabel></MudTh>
 | 
						|
            <MudTh><MudTableSortLabel SortBy="new Func<WeatherForecast, object>(x=>x.Summary!)">Summary</MudTableSortLabel></MudTh>
 | 
						|
        </HeaderContent>
 | 
						|
        <RowTemplate>
 | 
						|
            <MudTd DataLabel="Date">@context.Date</MudTd>
 | 
						|
            <MudTd DataLabel="Temp. (C)">@context.TemperatureC</MudTd>
 | 
						|
            <MudTd DataLabel="Temp. (F)">@context.TemperatureF</MudTd>
 | 
						|
            <MudTd DataLabel="Summary">@context.Summary</MudTd>
 | 
						|
        </RowTemplate>
 | 
						|
        <PagerContent>
 | 
						|
            <MudTablePager PageSizeOptions="new int[]{50, 100}" />
 | 
						|
        </PagerContent>
 | 
						|
    </MudTable>
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
@code {
 | 
						|
    private WeatherForecast[]? forecasts;
 | 
						|
 | 
						|
    protected override async Task OnInitializedAsync()
 | 
						|
    {
 | 
						|
        forecasts = await ForecastService.GetForecastAsync(DateTime.Now);
 | 
						|
    }
 | 
						|
}
 |