Example #1
0
 public async Task <GetArticleByIdResponse> Handle(GetArticleByIdRequest request)
 {
     return(new GetArticleByIdResponse()
     {
         Article = ArticleApiModel.FromArticle(await _dataContext.Articles.FindAsync(request.Id))
     });
 }
Example #2
0
            public async Task <GetArticlesResponse> Handle(GetArticlesRequest request)
            {
                var articles = await _dataContext.Articles.ToListAsync();

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