public IActionResult Delete(int Id) { // THIS LINE ALSO NEEDS HELP NewMovieResponse newMovieResponse = context.Movies.Single(x => x.id == Id); context.Remove(newMovieResponse); context.SaveChanges(); return(RedirectToAction("MovieList")); }
public IActionResult NewMovie(NewMovieResponse movieResponse) { if (ModelState.IsValid) { MovieList.AddMovie(movieResponse); return(View("Confirmation", movieResponse)); } else { return(View()); } }
public IActionResult NewMovie(NewMovieResponse movieResponse) { if (ModelState.IsValid) { context.Movies.Add(movieResponse); context.SaveChanges(); // TempStorage.AddNewMovie(movieResponse); return(View("Confirmation", movieResponse)); } return(View()); }
public IActionResult Edit2(NewMovieResponse newMovieResponse) { if (ModelState.IsValid) { var movie = context.Movies.Single(x => x.id == newMovieResponse.id); context.Entry(movie).Property(x => x.Category).CurrentValue = newMovieResponse.Category; context.Entry(movie).Property(x => x.Title).CurrentValue = newMovieResponse.Title; context.Entry(movie).Property(x => x.Year).CurrentValue = newMovieResponse.Year; context.Entry(movie).Property(x => x.Director).CurrentValue = newMovieResponse.Director; context.Entry(movie).Property(x => x.Rating).CurrentValue = newMovieResponse.Rating; context.Entry(movie).Property(x => x.Edited).CurrentValue = newMovieResponse.Edited; context.Entry(movie).Property(x => x.Lent).CurrentValue = newMovieResponse.Lent; context.Entry(movie).Property(x => x.Notes).CurrentValue = newMovieResponse.Notes; context.SaveChanges(); return(RedirectToAction("MovieList")); } else { return(View()); } }
public IActionResult Edit1(int Id) { NewMovieResponse newMovieResponse = context.Movies.Single(x => x.id == Id); return(View("Edit", newMovieResponse)); }