diff --git a/nrdkwebsite/Program.cs b/nrdkwebsite/Program.cs index 860cee6..0659947 100644 --- a/nrdkwebsite/Program.cs +++ b/nrdkwebsite/Program.cs @@ -46,7 +46,7 @@ app.MapDelete("/api/users/{id:int}", async (int id, DatabaseHandler db) => { return Results.Json(user); }); //WORKS 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.SaveChangesAsync(); return user;