Ejemplo n.º 1
0
        /// <summary>
        /// Creates a GenreFull object based on provided Id
        /// </summary>
        /// <param name="id">Genre Id</param>
        /// <returns>GenreFull object based on id</returns>
        public GenreFull GetGenreFull(int? id)
        {
            RepoMovie Repo_Movies = new RepoMovie();
            Genre genre = dc.Genres.Include("Movies").FirstOrDefault(g => g.Id == id);
            GenreFull gf = new GenreFull();
            gf.Id = genre.Id;
            gf.Name = genre.Name;

            List<MovieForList> movieFullList = new List<MovieForList>();

            foreach(Movie m in genre.Movies)
            {
                MovieForList mf = Repo_Movies.GetMovieForList(m.Id);
                movieFullList.Add(mf);
            }

            gf.Movies = movieFullList;

            return gf;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates a DirectorFull object based on provided Id
        /// </summary>
        /// <param name="id">Director Id</param>
        /// <returns>DirectorFull object based on id</returns>
        public DirectorFull GetDirectorFull(int? id)
        {
            RepoMovie Repo_Movie = new RepoMovie();
            Director director = dc.Directors.Include("Movies").FirstOrDefault(d => d.Id == id);
            DirectorFull df = new DirectorFull();

            df.Id = director.Id;
            df.Name = director.Name;

            List<MovieForList> mfList = new List<MovieForList>();

            foreach (Movie m in director.Movies)
            {
                MovieForList mf = Repo_Movie.GetMovieForList(m.Id);
                mfList.Add(mf);
            }

            df.Movies = mfList;

            return df;
        }