Example #1
0
        public void Create( Movie movie )
        {
            using ( MovieIndexContext context = new MovieIndexContext( ) )
            {
                context.Movies.Add( movie );

                context.SaveChanges( );
            }
        }
Example #2
0
        public void Update( Movie movie )
        {
            using ( MovieIndexContext context = new MovieIndexContext( ) )
            {
                context.Entry( movie ).State = EntityState.Modified;

                context.SaveChanges( );
            }
        }
Example #3
0
        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 );
        }