コード例 #1
0
        public ActionResult Add()
        {
            var ops = new MovieOperations();

            MovieInfoVM movieInfoVm = new MovieInfoVM();

            movieInfoVm.CreateMpaaRatingsList(ops.GetAllMpaaRatings().MpaaRatings);
            movieInfoVm.CreateActorsList(ops.GetAllActors().Actors);
            movieInfoVm.CreateBorrowersList(ops.GetAllBorrowers().Borrowers);
            movieInfoVm.CreateStudiosList(ops.GetAllStudios().Studios);
            movieInfoVm.CreateDirectorsList(ops.GetAllDirectors().Directors);

            return View(movieInfoVm);
        }
コード例 #2
0
        public ActionResult Add(MovieInfoVM movieInfoVm)
        {
            var ops = new MovieOperations();

            movieInfoVm.CreateMpaaRatingsList(ops.GetAllMpaaRatings().MpaaRatings);
            movieInfoVm.CreateActorsList(ops.GetAllActors().Actors);
            movieInfoVm.CreateBorrowersList(ops.GetAllBorrowers().Borrowers);
            movieInfoVm.CreateStudiosList(ops.GetAllStudios().Studios);
            movieInfoVm.CreateDirectorsList(ops.GetAllDirectors().Directors);

            if (ModelState.IsValid)
            {
                var addMovieResponse = ops.AddMovie(movieInfoVm.Movie);
                var addedMovieResponse = ops.GetMovieByID(addMovieResponse.Movie.MovieID);

                return View("Details", addedMovieResponse.Movie);
            }
            else
            {
                return View(movieInfoVm);
            }
        }