public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Attach(ActivityRecord).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ActivityRecordExists(ActivityRecord.ID)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.ActivityRecord.Add(ActivityRecord); await _context.SaveChangesAsync(); return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } ActivityRecord = await _context.ActivityRecord.FindAsync(id); if (ActivityRecord != null) { _context.ActivityRecord.Remove(ActivityRecord); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } User = await _context.User.FindAsync(id); if (User != null) { _context.User.Remove(User); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }