public List<Movie> Update(Movie movie) { List<Movie> lstMovies = GetAll().Where(x=> x.id != movie.id).ToList(); Movie m = GetMovie(movie.id); lstMovies.Add(movie); return lstMovies; }
public ActionResult Create(Movie movie) { if (ModelState.IsValid) { movieRepository.InsertOrUpdate(movie); movieRepository.Save(); return RedirectToAction("Index"); } else { ViewBag.PossibleDirectors = directorRepository.All; ViewBag.PossibleCountries = countryRepository.All; return View(); } }
public List<Movie> Create(Movie movie) { List<Movie> lstMovies = GetAll(); lstMovies.Add(movie); return lstMovies; }
public void InsertOrUpdate(Movie movie) { if (movie.ID == default(int)) { // New entity context.Movies.Add(movie); } else { // Existing entity context.Entry(movie).State = EntityState.Modified; } }