Example #1
0
        public IEnumerable <News> Query(NewsSpecifications specifications = null)
        {
            var result = _newsProvider.GetAll();

            if (specifications == null)
            {
                return(result);
            }

            if (specifications.NewsId.HasValue)
            {
                result = result.Where(w => w.Id == specifications.NewsId);
            }

            return(result);
        }
Example #2
0
 public async Task <IEnumerable <News> > QueryAsync(NewsSpecifications specifications = null)
 {
     return(await Task.Run(() => Query(specifications)));
 }