public void Create( Movie movie ) { using ( MovieIndexContext context = new MovieIndexContext( ) ) { context.Movies.Add( movie ); context.SaveChanges( ); } }
public void Update( Movie movie ) { using ( MovieIndexContext context = new MovieIndexContext( ) ) { context.Entry( movie ).State = EntityState.Modified; context.SaveChanges( ); } }
public ActionResult Edit( Movie movie ) { if ( ModelState.IsValid ) { _movieRepository.Update( movie ); return RedirectToAction( "Index" ); } ViewBag.GenreId = new SelectList( _genreRepository.GetAll( ), "Id", "Description" ); return View( movie ); }