// To protect from overposting attacks, enable the specific properties you want to bind to, for // more details, see https://aka.ms/RazorPagesCRUD. public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Attach(Movies).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MoviesExists(Movies.Movie_Id)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); }
// To protect from overposting attacks, enable the specific properties you want to bind to, for // more details, see https://aka.ms/RazorPagesCRUD. public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Movies.Add(Movies); await _context.SaveChangesAsync(); return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } UpcomingMovies = await _context.UpcomingMovies.FindAsync(id); if (UpcomingMovies != null) { _context.UpcomingMovies.Remove(UpcomingMovies); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } Ranking = await _context.Ranking.FindAsync(id); if (Ranking != null) { _context.Ranking.Remove(Ranking); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } MoviesCollection = await _context.MoviesCollection.FindAsync(id); if (MoviesCollection != null) { _context.MoviesCollection.Remove(MoviesCollection); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }