加入專案檔案。
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
using CoreProfilerExample.Repository.Interfaces;
|
||||
using CoreProfilerExample.Repository.Models.DataModels;
|
||||
using static CoreProfilerExample.Common.Constants.WeatherConstant;
|
||||
|
||||
namespace CoreProfilerExample.Repository.Implements
|
||||
{
|
||||
public class WeatherForecastRepository : IWeatherForecastRepository
|
||||
{
|
||||
public Task<IEnumerable<WeatherForecastDataModel>> GetAsync(int days)
|
||||
{
|
||||
return Task.Run(() => days > 0 ? Enumerable.Range(1, days).Select(index => new WeatherForecastDataModel
|
||||
{
|
||||
Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)),
|
||||
TemperatureC = Random.Shared.Next(-20, 55),
|
||||
Summary = WeatherSummaries[Random.Shared.Next(WeatherSummaries.Length)]
|
||||
}) : []);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user