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