public async Task <IEnumerable <Post> > HandleAsync() { var expression = new GetPostByCategoryQueryExpression { Category = Category }; return(IncludeData ? await Context.Posts .Where(expression.AsExpression()) .Include(p => p.Author).Include(p => p.Blog).Include(p => p.Category) .ToListAsync() : await Context.Posts .Where(expression.AsExpression()) .ToListAsync()); }
public IEnumerable <Post> Handle() { var expression = new GetPostByCategoryQueryExpression { Category = Category }; return(IncludeData ? Context.Posts .Where(expression.AsExpression()) .Include(p => p.Author).Include(p => p.Blog).Include(p => p.Category) .ToList() : Context.Posts .Where(expression.AsExpression()) .ToList()); }