public ArticlesController( IOptions <ArticlesOptions> articlesOptions, IAuthorizationService authorizationService, ICategoriesCache categoriesCache, OperationKeysContainer operationKeysContainer, IArticlesPresenter articlesPresenter, IServiceProvider serviceProvider) : base(serviceProvider) { OperationKeys = operationKeysContainer; this.articlesOptions = articlesOptions.Value; this.authorizationService = authorizationService; this.categoriesCache = categoriesCache; this.articlesPresenter = articlesPresenter; }
public async Task <IActionResult> GetArticles([FromQuery] int pageNumber, [FromQuery] ArticlesOptions articlesOptions) { var articles = await feedService.GetArticles(pageNumber == 0? 1 : pageNumber, appSettings.Value.PageSize, articlesOptions); return(Ok(articles)); }
public async Task <ArticlePageList> GetArticles(int pageNumber, int pageSize, ArticlesOptions articlesOptions = null) { var articles = await articleRepository.GetFilteredListPage(pageSize, pageNumber, articlesOptions.SourceIds); return(new ArticlePageList { CurrentPage = pageNumber, PageSize = pageSize, TotalItems = await articleRepository.Count(articlesOptions.SourceIds), Articles = articles.ToList() }); }