public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } Department = await _context.Departments.SingleOrDefaultAsync(m => m.Id == id); if (Department == null) { return(NotFound()); } return(Page()); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } Department = await _context.Departments.FindAsync(id); if (Department != null) { _context.Departments.Remove(Department); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }