// To protect from overposting attacks, enable the specific properties you want to bind to, for // more details, see https://aka.ms/RazorPagesCRUD. public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } // not really used, but i hate the idea of storing passwords in plain text User.PasswordHash = PasswordHashGenerator.GenerateHash(User.PasswordHash); if (User.ProfilePicture == null) { User.ProfilePicture = "./img/user.png"; } _context.Attach(User).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!UserExists(User.UserID)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); }
// To protect from overposting attacks, enable the specific properties you want to bind to, for // more details, see https://aka.ms/RazorPagesCRUD. public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Attach(Picture).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PictureExists(Picture.PictureID)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); }