mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-02-16 10:42:08 +00:00
restructure seed
This commit is contained in:
@@ -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." });
|
||||
|
||||
@@ -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.");
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user