1
0

加入專案檔案。

This commit is contained in:
2024-03-25 16:13:35 +08:00
parent c16cecfc42
commit 739e92cee8
26 changed files with 459 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\CoreProfilerExample.Common\CoreProfilerExample.Common.csproj" />
</ItemGroup>
</Project>

View File

@@ -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)]
}) : []);
}
}
}

View File

@@ -0,0 +1,9 @@
using CoreProfilerExample.Repository.Models.DataModels;
namespace CoreProfilerExample.Repository.Interfaces
{
public interface IWeatherForecastRepository
{
public Task<IEnumerable<WeatherForecastDataModel>> GetAsync(int days);
}
}

View File

@@ -0,0 +1,11 @@
namespace CoreProfilerExample.Repository.Models.DataModels
{
public class WeatherForecastDataModel
{
public DateOnly Date { get; set; }
public int TemperatureC { get; set; }
public string? Summary { get; set; }
}
}