public async Task <IEnumerable <ArticleDto> > Handle(GetArticles request, CancellationToken cancellationToken) { return(_articles.Select(a => new ArticleDto { Title = a.Title, Description = a.Description, Id = a.Id, Body = a.Body, Tags = a.Tags, })); }
public async Task <IEnumerable <ArticleDto> > Handle(GetArticles request, CancellationToken cancellationToken) { var articles = await _context.Articles .Include(a => a.Ads) .Include(a => a.Comments) .Include(a => a.Category) .Include(a => a.Creator) .Include(a => a.ContentVisitors) .ToListAsync(cancellationToken); return(articles.AsDto()); }
public async Task <PageModel <ArticleModel> > GetArticlesAsync([FromBody] GetArticles getArticles) { return(await _mediator.Send(getArticles)); }