Restructure data access layer/data layer

This commit is contained in:
Aaron Po
2026-01-11 23:36:26 -05:00
parent 8d6b903aa7
commit 372aac897a
17 changed files with 457 additions and 256 deletions

View File

@@ -30,17 +30,22 @@ catch
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
// Learn more about configuring OpenAPI at https://aka.ms/aspnet/openapi
builder.Services.AddOpenApi();
// Add services to the container.
// Learn more about configuring OpenAPI at https://aka.ms/aspnet/openapi
builder.Services.AddControllers();
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
builder.Services.AddOpenApi();
var app = builder.Build();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.MapOpenApi();
}
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
app.MapOpenApi();
}
app.UseHttpsRedirection();
@@ -58,24 +63,6 @@ var summaries = new[]
"Scorching",
};
app.MapGet(
"/weatherforecast",
() =>
{
var forecast = Enumerable
.Range(1, 5)
.Select(index => new WeatherForecast(
DateOnly.FromDateTime(DateTime.Now.AddDays(index)),
Random.Shared.Next(-20, 55),
summaries[Random.Shared.Next(summaries.Length)]
))
.ToArray();
return forecast;
}
)
.WithName("GetWeatherForecast");
// Register controllers
app.MapControllers();
app.Run();