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