public async Task <IActionResult> GetArticles(int userId, [FromQuery] ArticleParams articleParams) { articleParams.UserId = userId; if (articleParams.UserId != int.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value)) { return(Unauthorized()); } var articlesFromRepo = await _repo.GetArticlesForUser(articleParams); if (articlesFromRepo == null) { return(NotFound()); } Response.AddPagination(articlesFromRepo.CurrentPage, articlesFromRepo.SizePage, articlesFromRepo.TotalCount, articlesFromRepo.Total); var articleReturn = Mapper.Map <IList <ArticleForListDto> > (articlesFromRepo); return(Ok(articleReturn)); }