public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Attach(AquariumUser).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AquariumUserExists(AquariumUser.Id)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } AquariumUser = await _context.AquariumUser.FindAsync(id); if (AquariumUser != null) { _context.AquariumUser.Remove(AquariumUser); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } string password = GeneratePassword(); SendEmail(AquariumUser.Email, password); AquariumUser.Password = CipherService.Encrypt(password); AquariumUser.RegistrationDate = DateTime.Now; AquariumUser.Type++; _context.AquariumUser.Add(AquariumUser); await _context.SaveChangesAsync(); return(RedirectToPage("./Index")); }