public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Attach(NotificationSetting).State = EntityState.Modified; var userId = long.Parse(User.FindFirstValue(ClaimTypes.NameIdentifier)); NotificationSetting.ApplicationUserId = userId; try { await _context.SaveChangesAsync(); StatusMessage = "Notification settings updated"; } catch (DbUpdateConcurrencyException) { if (!NotificationSettingExists(NotificationSetting.NotificationSettingId)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Attach(AcmeAccount).State = EntityState.Modified; try { await _context.SaveChangesAsync(); StatusMessage = "Account updated"; } catch (DbUpdateConcurrencyException) { if (!AcmeAccountExists(AcmeAccount.AcmeAccountId)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); }