public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Attach(Course).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CourseExists(Course.Id)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } Module = await _context.Modules.FindAsync(id); if (Module != null) { _context.Modules.Remove(Module); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public async Task<IActionResult> OnPostAsync(int? id) { if (id == null) { return NotFound(); } Item = await _context.Items.FindAsync(id); if (Item != null) { _context.Items.Remove(Item); await _context.SaveChangesAsync(); } return RedirectToPage("./Index"); }