Rename projects to FileShare
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
using FileShare_EFCore.Models;
|
||||
|
||||
namespace FileShare_Services.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// 天气预报服务,随机生成未来 5 天的天气预报数据。
|
||||
/// </summary>
|
||||
public class WeatherForecastService
|
||||
{
|
||||
private static readonly string[] Summaries =
|
||||
[
|
||||
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
|
||||
];
|
||||
|
||||
/// <summary>
|
||||
/// 生成未来 5 天的随机天气预报数据。
|
||||
/// </summary>
|
||||
/// <returns>天气预报数据集合。</returns>
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user