Esempio n. 1
0
        /// <summary>
        /// Creates a DirectorForList object based on provided Id
        /// </summary>
        /// <param name="id">Director Id</param>
        /// <returns>DirectorForList object based on id</returns>
        public DirectorForList GetDirectorForList(int? id)
        {
            Director director = dc.Directors.Include("Movies").FirstOrDefault(d => d.Id == id);
            DirectorForList df = new DirectorForList();

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

            return df;
        }
Esempio n. 2
0
        /// <summary>
        /// Creates List of DirectorForList to be presented in the Director List View
        /// </summary>
        /// <returns>List of DirectorForList</returns>
        public IEnumerable<DirectorForList> GetDirectorsForList()
        {
            var forList = dc.Directors.OrderBy(director => director.Name);

            List<DirectorForList> directorsForList = new List<DirectorForList>();

            foreach (Director d in forList)
            {
                DirectorForList dfl = new DirectorForList();
                dfl.Id = d.Id;
                dfl.Name = d.Name;
                directorsForList.Add(dfl);
            }

            return directorsForList;
        }
Esempio n. 3
0
        public IEnumerable<DirectorForList> getDirectorsForList()
        {
            var dr = dc.Directors.OrderBy(dd => dd.Name).AsEnumerable();

            List<DirectorForList> dl = new List<DirectorForList>();

            foreach (var item in dr)
            {
                DirectorForList dfl = new DirectorForList();

                dfl.Id = item.Id;
                dfl.Name = item.Name;
                dl.Add(dfl);
            }

            return dl;
        }