예제 #1
0
            private IQueryable <Persistent.Dream> FilterSponsor(IQueryable <Persistent.Dream> dreams, DreamFilter filter)
            {
                if (filter.HasSponsor.HasValue && filter.HasSponsor.Value)
                {
                    dreams = dreams.Where(x => x.Sponsor != null);
                }

                return(dreams);
            }
예제 #2
0
            private IQueryable <Persistent.Dream> FilterSex(IQueryable <Persistent.Dream> dreams, DreamFilter filter)
            {
                if (!string.IsNullOrWhiteSpace(filter.Sex))
                {
                    dreams = dreams.Where(x => x.Dreamer != null && x.Dreamer.Sex == filter.Sex);
                }

                return(dreams);
            }
예제 #3
0
            private IQueryable <Persistent.Dream> FilterCategories(IQueryable <Persistent.Dream> dreams, DreamFilter filter)
            {
                if (filter.Categories != null && filter.Categories.Any())
                {
                    var categoriesId = _dbContext.Categories.Where(c => filter.Categories.Any(fc => fc == c.Description)).Select(x => x.Id);
                    dreams = dreams.Where(x => x.Categories.Any(x => categoriesId.Contains(x.CategoryId)));
                }

                return(dreams);
            }
예제 #4
0
            private IQueryable <Persistent.Dream> FilterMaxAge(IQueryable <Persistent.Dream> dreams, DreamFilter filter)
            {
                if (filter.MaxAge.HasValue)
                {
                    int minYearOfBirth = DateTime.Now.Year - filter.MaxAge.Value;
                    dreams = dreams.Where(x => x.Dreamer != null && x.Dreamer.YearOfBirth >= minYearOfBirth);
                }

                return(dreams);
            }
예제 #5
0
 public GetAllQuery(DreamFilter filter, PagingOptions pagingOptions)
 {
     Filter        = filter;
     PagingOptions = pagingOptions;
 }
예제 #6
0
            private IQueryable <Persistent.Dream> FilterProceed(IQueryable <Persistent.Dream> dreams, DreamFilter filter)
            {
                if (filter.CanProceed.HasValue && filter.CanProceed.Value)
                {
                    dreams = dreams.Where(x => x.CanProceed == true);
                }

                return(dreams);
            }