fix new user id
This commit is contained in:
parent
097101bce8
commit
3e12567937
1 changed files with 1 additions and 1 deletions
|
@ -46,7 +46,7 @@ app.MapDelete("/api/users/{id:int}", async (int id, DatabaseHandler db) => {
|
||||||
return Results.Json(user);
|
return Results.Json(user);
|
||||||
}); //WORKS
|
}); //WORKS
|
||||||
app.MapPost("/api/users", async (NewUser newuser, DatabaseHandler db) => {
|
app.MapPost("/api/users", async (NewUser newuser, DatabaseHandler db) => {
|
||||||
User user = new User(newuser.nickname, db.users.Count() + 1, newuser.mast);
|
User user = new User(newuser.nickname, db.users.OrderBy(p => p.id).Last().id + 1, newuser.mast);
|
||||||
await db.users.AddAsync(user);
|
await db.users.AddAsync(user);
|
||||||
await db.SaveChangesAsync();
|
await db.SaveChangesAsync();
|
||||||
return user;
|
return user;
|
||||||
|
|
Loading…
Reference in a new issue