public async Task <IActionResult> Create([Bind("MovieID,Category,Title,Year,Director,Rating,LentTo,Edited,Notes")] Movie movie) { if (ModelState.IsValid) { _context.Add(movie); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(ViewMovies))); //after submitting redirects you back to the movie list } return(View(movie)); //the movie object is added to the database }
public async Task <IActionResult> Create([Bind("Id,Title,ReleaseDate,Genre,Rating")] Movie movie) { if (ModelState.IsValid) { _context.Add(movie); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(movie)); }
public async Task <IActionResult> Create([Bind("MovieId,Category,Title,Year,Director,Rating,LentTo,Edited,Notes")] Movie movie) { if (ModelState.IsValid) { _context.Add(movie); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(MovieList))); } return(View(movie)); }