public ActionResult Edit(MovieFull mf, FormCollection collection)
 {
     try
     {
         return RedirectToAction("Index");
     }
     catch
     {
         return View();
     }
 }
Beispiel #2
0
        /// <summary>
        /// Creates a MovieFull object based on provided Id
        /// </summary>
        /// <param name="id">Movie Id</param>
        /// <returns>MovieFull object based on id</returns>
        public MovieFull GetMovieFull(int? id)
        {
            RepoDirector Repo_Director = new RepoDirector();
            RepoGenre Repo_Genre = new RepoGenre();

            Movie movie = dc.Movies.Include("Director").FirstOrDefault(m => m.Id == id);
            MovieFull mf = new MovieFull();

            mf.Id = movie.Id;
            mf.TicketPrice = movie.TicketPrice;
            mf.Title = movie.Title;
            mf.Director = Repo_Director.GetDirectorFull(movie.Director.Id);

            List<GenreFull> genreFullList = new List<GenreFull>();

            foreach (Genre g in movie.Genres)
            {
                GenreFull gf = Repo_Genre.GetGenreFull(g.Id);
                genreFullList.Add(gf);
            }

            mf.Genres = genreFullList;

            return mf;
        }