public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } Content = await _context.Content .Include(c => c.Category).FirstOrDefaultAsync(m => m.ID == id); if (Content == null) { return(NotFound()); } return(Page()); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } Content = await _context.Content.FindAsync(id); if (Content != null) { _context.Content.Remove(Content); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } Content = await _context.Content .Include(c => c.Category).FirstOrDefaultAsync(m => m.ID == id); if (Content == null) { return(NotFound()); } ViewData["CategoryID"] = new SelectList(_context.Category, "ID", "CategoryName"); return(Page()); }