// added with app.MapPost("/usernew", UserPost);
public static void UserPost (string email, string userName, string password)
{
using (var ctx = new EventtuallyContext())
{
var hasher = new PasswordHasher<User>();
ctx.Add(new User {
UserName = userName,
Email = email,
PasswordHash = hasher.HashPassword(null!, password),
RegistrationDate = DateTime.Now
});
ctx.SaveChanges();
}
}
// added with app.MapPost("/usernew", UserPost);
public static void UserPost (string email, string userName, string password)
{
using (var ctx = new EventtuallyContext())
{
var hasher = new PasswordHasher<User>();
ctx.Add(new User {
UserName = userName,
Email = email,
PasswordHash = hasher.HashPassword(null!, password),
RegistrationDate = DateTime.Now
});
ctx.SaveChanges();
}
}