15 lines
403 B
C#
15 lines
403 B
C#
namespace HelloShop.WebApp;
|
|
|
|
public class WeatherApiClient(HttpClient httpClient)
|
|
{
|
|
public async Task<WeatherForecast[]> GetWeatherAsync()
|
|
{
|
|
return await httpClient.GetFromJsonAsync<WeatherForecast[]>("/weatherforecast") ?? [];
|
|
}
|
|
}
|
|
|
|
public record WeatherForecast(DateOnly Date, int TemperatureC, string? Summary)
|
|
{
|
|
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
|
|
}
|