public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } Note = await _context.Note.FindAsync(id); if (Note != null) { Note.Disabled = true; } _context.Attach(Note).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!NoteExists(Note.NoteId)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Attach(Class).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ClassExists(Class.ClassId)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); }