public BlogController(IBlogQuery blogQuery, IBlogService blogService) { _blogQuery = blogQuery; _blogService = blogService; }
async private Task <IEnumerable <PostRelated> > UseQuery(BlogDbContext context, IBlogQuery query) { var source = context.Set <PostRelated>().Include(p => p.Current) .Where(x => x.Current.Id == Guid.Empty || (x.EndDate >= _clock.UtcNow.DateTime && x.StartDate <= _clock.UtcNow.DateTime)); query.Get(source); var result = await source.ToListAsync(); return(result.AsEnumerable()); }
public BlogController(IBlogQuery query, IBlogCommand command) { _query = query; _command = command; }
async public Task <object> Query(IBlogQuery query) => (await Query(async ctx => (await UseQuery(ctx, query)).AsEnumerable())) .ToFormat() .ToArray();
async public Task <Blogs> GetBlogs(IBlogQuery query) => new Blogs(await query.Get(_context).ToArrayAsync());