restructure seed

This commit is contained in:
Aaron Po
2026-01-13 20:10:39 -05:00
parent 7fbdfbf542
commit b5ab6f6893
40 changed files with 1002 additions and 873 deletions

View File

@@ -4,10 +4,10 @@ namespace WebAPI.Controllers
{
[ApiController]
[ApiExplorerSettings(IgnoreApi = true)]
[Route("error")] // ← required
[Route("error")] // ← required
public class NotFoundController : ControllerBase
{
[HttpGet("404")] // ← required
[HttpGet("404")] // ← required
public IActionResult Handle404()
{
return NotFound(new { message = "Route not found." });

View File

@@ -1,5 +1,5 @@
using DataAccessLayer.Entities;
using BusinessLayer.Services;
using DataAccessLayer.Entities;
using Microsoft.AspNetCore.Mvc;
namespace WebAPI.Controllers
@@ -79,9 +79,15 @@ namespace WebAPI.Controllers
}
[HttpPut("{id:guid}")]
public IActionResult UpdateUser(Guid id, [FromBody] UserAccount userAccount)
public IActionResult UpdateUser(
Guid id,
[FromBody] UserAccount userAccount
)
{
if (userAccount.UserAccountID != Guid.Empty && userAccount.UserAccountID != id)
if (
userAccount.UserAccountID != Guid.Empty
&& userAccount.UserAccountID != id
)
{
return BadRequest("UserAccountID does not match route id.");
}

View File

@@ -2,25 +2,24 @@ using BusinessLayer.Services;
using DataAccessLayer;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddControllers();
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
builder.Services.AddOpenApi();
builder.Services.AddScoped<IUserAccountRepository, UserAccountRepository>();
builder.Services.AddScoped<IUserService, UserService>();
var app = builder.Build();
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
app.MapOpenApi();
}
var app = builder.Build();
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
app.MapOpenApi();
}
app.UseHttpsRedirection();
app.MapControllers();
app.MapFallbackToController("Handle404", "NotFound");
app.Run();