Exemple #1
0
 public async Task <GetArticleBySlugResponse> Handle(GetArticleBySlugRequest request)
 {
     return(new GetArticleBySlugResponse()
     {
         Article = ArticleApiModel.FromArticle(await _context.Articles.SingleAsync(a => a.Slug == request.Slug))
     });
 }
 public async Task <GetArticleByIdResponse> Handle(GetArticleByIdRequest request)
 {
     return(new GetArticleByIdResponse()
     {
         Article = ArticleApiModel.FromArticle(await _context.Articles
                                               .Include(x => x.Author)
                                               .SingleAsync(x => x.Id == request.Id))
     });
 }
 public async Task <Response> Handle(Request request)
 {
     return(new Response()
     {
         Article = ArticleApiModel.FromArticle(await _context.Articles
                                               .Include(x => x.Tenant)
                                               .Where(x => x.Tenant.UniqueId == request.TenantUniqueId)
                                               .SingleAsync(a => a.Slug == request.Slug))
     });
 }
Exemple #4
0
            public async Task <GetArticlesResponse> Handle(GetArticlesRequest request)
            {
                var articles = await _context.Articles
                               .Include(x => x.Author)
                               .ToListAsync();

                return(new GetArticlesResponse()
                {
                    Articles = articles.Select(x => ArticleApiModel.FromArticle(x)).ToList()
                });
            }
Exemple #5
0
            public async Task <Response> Handle(Request request)
            {
                var articles = await _context.Articles
                               .Include(x => x.Author)
                               .Include(x => x.Tenant)
                               .Where(x => x.Tenant.UniqueId == request.TenantUniqueId)
                               .ToListAsync();

                return(new Response()
                {
                    Articles = articles.Select(x => ArticleApiModel.FromArticle(x)).ToList()
                });
            }