public ActionResult Update(MovieViewModel newViewModel)
        {
            if(!ModelState.IsValid)
            {
                newViewModel.Genres = _context.Genres.ToList();

                return View("Edit", newViewModel);
            }

            var movie = _context.Movies.SingleOrDefault(m => m.Id == newViewModel.Id);

            movie.Name = newViewModel.Name;
            movie.ReleaseDate = newViewModel.GetDate();
            movie.GenreId = newViewModel.Genre;
            movie.NumberInStock = newViewModel.NumberInStock.Value;

            _context.SaveChanges();

            return RedirectToAction("MovieList", "Movies");
        }
        public ActionResult Create(MovieViewModel newMovie)
        {
            if(!ModelState.IsValid)
            {
                newMovie.Genres = _context.Genres.ToList();
                return View("Create", newMovie);
            }

            var movie = new Movie
            {
                Name = newMovie.Name,
                ReleaseDate = newMovie.GetDate(),
                DateAdded = DateTime.Now,
                GenreId = newMovie.Genre,
                NumberInStock = newMovie.NumberInStock.Value,
                NumberAvailable = newMovie.NumberInStock.Value
            };

            _context.Movies.Add(movie);
            _context.SaveChanges();

            return RedirectToAction("Index", "Home");
        }