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); }
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); }
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); }
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); }
public GetAllQuery(DreamFilter filter, PagingOptions pagingOptions) { Filter = filter; PagingOptions = pagingOptions; }
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); }