public List <ArticleResponseModel> GetStoriesBySection(SectionType sectionType, Func <Result, bool> condition) { sectionType.ThrowIfDefault(nameof(sectionType)); condition.ThrowIfNull(nameof(condition)); return(GetStoriesBySectionAndFilter(sectionType, condition)); }
public List <ArticleGroupByDateResponseModel> GetArticleGroupBySection(SectionType sectionType) { sectionType.ThrowIfDefault(nameof(sectionType)); var articlesResult = _webProvider.GetArticlesNyt(sectionType); if (articlesResult == null || articlesResult.results?.Count == 0) { throw new System.Exception("Nothing has been returned."); } return(_mapperFactory.GetMapper <ArticlesNYT, ArticleGroupByDateResponseModel>().Map(articlesResult)); }
private List <ArticleResponseModel> GetStoriesBySectionAndFilter(SectionType sectionType, Func <Result, bool> condition = null) { sectionType.ThrowIfDefault(nameof(sectionType)); var articlesResult = _webProvider.GetArticlesNyt(sectionType); if (articlesResult == null || articlesResult.results?.Count == 0) { throw new System.Exception("Nothing has been returned."); } if (condition != null) { articlesResult.results = articlesResult.results.Where(condition).ToList(); } return(_mapperFactory.GetMapper <ArticlesNYT, ArticleResponseModel>().Map(articlesResult)); }
public List <ArticleResponseModel> GetStoriesBySection(SectionType sectionType) { sectionType.ThrowIfDefault(nameof(sectionType)); return(GetStoriesBySectionAndFilter(sectionType)); }