Пример #1
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 MovieForList GetMovieForList(int? id)
        {
            Movie movie = dc.Movies.FirstOrDefault(m => m.Id == id);
            MovieForList mf = new MovieForList();

            mf.Id = movie.Id;
            mf.Title = movie.Title;

            return mf;
        }
Пример #2
0
        /// <summary>
        /// Creates List of MovieForList to be presented in the Movie List View
        /// </summary>
        /// <returns>List of MovieForList</returns>
        public IEnumerable<MovieForList> GetMoviesForList()
        {
            var forList = dc.Movies.OrderBy(movie => movie.Title);

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

            foreach (Movie m in forList)
            {
                MovieForList mfl = new MovieForList();
                mfl.Id = m.Id;
                mfl.Title = m.Title;
                moviesForList.Add(mfl);
            }

            return moviesForList;
        }