Пример #1
0
        public ActionResult Add()
        {
            var addedMoviewModel = new AddMoviewViewModel
            {
                Genre = _context.Genres.ToList()
            };

            return(View(addedMoviewModel));
        }
Пример #2
0
        public ActionResult Add(Movie movie)
        {
            if (ModelState.IsValid)
            {
                _context.Movies.Add(movie);
                _context.SaveChanges();
            }
            else
            {
                var addedMoviewModel = new AddMoviewViewModel
                {
                    Genre = _context.Genres.ToList()
                };

                return(View(addedMoviewModel));
            }

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