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