// GET: Movies/Delete/5
        public ActionResult Delete(int id)
        {
            Movie movie = MoviesDb.GetById(id);

            if (movie == null)
            {
                return(HttpNotFound());
            }
            return(View(movie));
        }
        // GET: Movies/Edit/5
        public ActionResult Edit(int id)
        {
            Movie movie = MoviesDb.GetById(id);

            if (movie == null)
            {
                return(HttpNotFound());
            }
            ViewBag.GenreId = new SelectList(GenresDb.GetAll(), "Id", "Name", movie.GenreId);
            return(View(movie));
        }
        public ActionResult Save(Movie movie)
        {
            if (!ModelState.IsValid)
            {
                return(RedirectToAction("Index", "Movies"));
            }
            if (movie.Id == 0)
            {
                MoviesDb.Add(movie);
            }
            else
            {
                var movieInDb = MoviesDb.GetById(movie.Id);
                // update properties
                movieInDb.Name = movie.Name;

                MoviesDb.Update(movieInDb);
            }
            return(RedirectToAction("Index", "Movies"));
        }
        public ActionResult Edit(int Id)
        {
            var movieInDb = MoviesDb.GetById(Id);

            return(View(movieInDb));
        }