Exemple #1
0
        public IEnumerable <Entity.detail> GetDetail(int id)
        {
            IEnumerable <Entity.detail> records = null;

            using (Access.TitlesEntities db = new Access.TitlesEntities())
            {
                records = db.Titles.Where(w => w.TitleId == id).ToList().Select(record => new Entity.detail
                {
                    movie = new Entity.title
                    {
                        id   = record.TitleId,
                        name = record.TitleName,
                        processedDateTime = record.ProcessedDateTimeUTC,
                        releaseYear       = record.ReleaseYear,
                        sortable          = record.TitleNameSortable,
                        typeId            = record.TitleTypeId
                    },
                    awards        = getAwards(record.Awards),
                    genre         = getGenre(record.TitleGenres),
                    description   = getDescription(record.StoryLines),
                    otherNames    = getOtherNames(record.OtherNames),
                    participiants = getParticipiants(record.TitleParticipants)
                }).ToList();
            }
            return(records);
        }
Exemple #2
0
        public IEnumerable <Entity.title> GetList(string keyword)
        {
            IEnumerable <Entity.title> records = null;

            using (Access.TitlesEntities db = new Access.TitlesEntities())
            {
                IEnumerable <Access.Title> result = db.Titles.AsEnumerable();
                if (!string.IsNullOrEmpty(keyword))
                {
                    result = result.Where(w => w.TitleName.ToLower().Contains(keyword.ToLower()));
                }
                records = result.OrderBy(o => o.TitleName).Select(record => new Entity.title
                {
                    id   = record.TitleId,
                    name = record.TitleName,
                    processedDateTime = record.ProcessedDateTimeUTC,
                    releaseYear       = record.ReleaseYear,
                    sortable          = record.TitleNameSortable,
                    typeId            = record.TitleTypeId
                }).ToList();
            }
            return(records);
        }