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