示例#1
0
        /// <summary>
        /// Edit Movie (Display)
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult Edit(int id)
        {
            GetMovieDetailResponse movie = _movieService.GetMovie(id);
            GetGenreListResponse genres = _genreService.GetGenres();
            GetCertificationListReponse certifications = _certificationService.GetCertification(); //new GetCertificationListReponse();

            var model = new DetailMovieEditView
                            {
                                Movie = movie.Movie,
                                Genres = new SelectList(genres.Genres, "Id", "Name"),
                                Certifications = new SelectList(certifications.Certifications, "Id", "Abbreviation", movie.Movie.CertificationId)
                            };
            return View(model);
        }
示例#2
0
        public ActionResult Edit(int id, DetailMovieEditView movieView, FormCollection collection)
        {
            var request = new AddUpdateMovieRequest
                                {
                                    Id = id,
                                    Name = movieView.Movie.Name,
                                    CertificationId = collection["CertificationId"] != "" ? Convert.ToInt32(collection["CertificationId"]) : 0,
                                    Released = movieView.Movie.Released,
                                    RunTime = movieView.Movie.RunTime,
                                    GenresId = collection["GenreId"] != "" ? Convert.ToInt32(collection["GenreId"]) : 0
                                };
            var response = _movieService.AddUpdateMovie(request);
            if (response.Successful)
                return RedirectToAction("Details", new {id = response.Id});

            return View(response);
        }