24 lines
738 B
C#
24 lines
738 B
C#
|
|
using Avalonia_Services.Models;
|
||
|
|
|
||
|
|
namespace Avalonia_Services.Services
|
||
|
|
{
|
||
|
|
public class WeatherForecastService
|
||
|
|
{
|
||
|
|
private static readonly string[] Summaries =
|
||
|
|
[
|
||
|
|
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
|
||
|
|
];
|
||
|
|
|
||
|
|
public IEnumerable<WeatherForecast> GetWeatherForecasts()
|
||
|
|
{
|
||
|
|
return Enumerable.Range(1, 5).Select(index => new WeatherForecast
|
||
|
|
{
|
||
|
|
Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)),
|
||
|
|
TemperatureC = Random.Shared.Next(-20, 55),
|
||
|
|
Summary = Summaries[Random.Shared.Next(Summaries.Length)]
|
||
|
|
})
|
||
|
|
.ToArray();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|