diff --git a/API_SQLuedo/API/API.csproj b/API_SQLuedo/API/API.csproj index 74687fb..cd3cbe6 100644 --- a/API_SQLuedo/API/API.csproj +++ b/API_SQLuedo/API/API.csproj @@ -1,4 +1,4 @@ - + net8.0 @@ -8,11 +8,13 @@ + all runtime; build; native; contentfiles; analyzers; buildtransitive + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/API_SQLuedo/API/Controllers/UserController.cs b/API_SQLuedo/API/Controllers/UserController.cs index 81f1f59..08ac4c5 100644 --- a/API_SQLuedo/API/Controllers/UserController.cs +++ b/API_SQLuedo/API/Controllers/UserController.cs @@ -52,7 +52,8 @@ namespace API.Controllers [HttpPut] public IActionResult CreateUser(string username, string password, string email, bool isAdmin) { - return Ok(_userDataService.CreateUser(username, password, email, isAdmin)); + // return Ok(_userDataService.CreateUser(username, password, email, isAdmin)); + return CreatedAtAction(nameof(GetUsers), _userDataService.CreateUser(username, password, email, isAdmin)); } } } diff --git a/API_SQLuedo/API/Program.cs b/API_SQLuedo/API/Program.cs index a8e96f7..80f106f 100644 --- a/API_SQLuedo/API/Program.cs +++ b/API_SQLuedo/API/Program.cs @@ -1,3 +1,4 @@ +using API; using DbContextLib; using Microsoft.AspNetCore.Identity; using Microsoft.EntityFrameworkCore; @@ -14,9 +15,11 @@ builder.Services.AddEndpointsApiExplorer(); builder.Services.AddSwaggerGen(); builder.Services.AddScoped(); builder.Services.AddDbContext(); +builder.Services.AddDbContext(options => options.UseInMemoryDatabase("appDb")); +builder.Services.AddIdentityApiEndpoints().AddEntityFrameworkStores(); builder.Services.AddAuthorization(); -builder.Services.AddIdentityApiEndpoints() - .AddEntityFrameworkStores(); +//builder.Services.AddIdentityApiEndpoints() +// .AddEntityFrameworkStores(); builder.Services.AddSwaggerGen(option => { option.SwaggerDoc("v1", new OpenApiInfo { Title = "Demo API", Version = "v1" }); diff --git a/API_SQLuedo/API/WebAPIDbContext.cs b/API_SQLuedo/API/WebAPIDbContext.cs new file mode 100644 index 0000000..afc8996 --- /dev/null +++ b/API_SQLuedo/API/WebAPIDbContext.cs @@ -0,0 +1,11 @@ +using Microsoft.AspNetCore.Identity; +using Microsoft.AspNetCore.Identity.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore; + +namespace API +{ + public class WebAPIDbContext : IdentityDbContext + { + public WebAPIDbContext(DbContextOptions options) : base(options) { } + } +}