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