Exemple #1
0
        public static IEnumerable <FilteredTitleCollection> GetAllAlphaIndex(List <TitleFilter> filters)
        {
            IEnumerable <char> firstLetters = from t in GetFilteredTitlesWrapper(filters)
                                              select GetProperIndex(t.SortName.ToUpper()[0]);

            return(from l in firstLetters
                   group l by l into g
                   orderby g.Key ascending
                   select new FilteredTitleCollection()
            {
                Name = g.Key.ToString(), Titles = TitleCollectionManager.ConvertDaoTitlesToTitles(from t in ApplyAlphaFilter(GetFilteredTitlesWrapper(filters), g.Key.ToString()) select t)
            });
        }
Exemple #2
0
        public static IEnumerable <FilteredTitleCollection> GetAllYearsGrouped(List <TitleFilter> filters)
        {
            IQueryable <Title> filteredTitles = GetFilteredTitlesWrapper(filters);

            return(from t in filteredTitles
                   where t.ReleaseDate != null
                   group t by t.ReleaseDate.Value.Year into g
                   orderby g.Key descending
                   select new FilteredTitleCollection()
            {
                Name = g.Key.ToString(),
                Titles = TitleCollectionManager.ConvertDaoTitlesToTitles(from t in filteredTitles where t.ReleaseDate != null && t.ReleaseDate.Value.Year == g.Key orderby t.SortName select t)
            });
        }
Exemple #3
0
        public static IEnumerable <FilteredTitleCollection> GetAllDateAddedGrouped(List <TitleFilter> filters)
        {
            IEnumerable <int> days = from t in GetFilteredTitlesWrapper(filters)
                                     where t.DateAdded.HasValue
                                     select(int)(DateTime.Now - t.DateAdded.Value).TotalDays;

            return(from d in days
                   from r in TitleConfig.DATE_ADDED_RANGE
                   where d >= r.Start && d < r.End
                   group r by r.End into g
                   orderby g.Key ascending
                   select new FilteredTitleCollection()
            {
                Name = TitleConfig.DaysToFilterString(g.Key),
                Titles = TitleCollectionManager.ConvertDaoTitlesToTitles(ApplyDateAddedFilter(GetFilteredTitlesWrapper(filters), TitleConfig.DaysToFilterString(g.Key)))
            });
        }