public virtual async Task <IActionResult> GetArticlesFromMultiCategories(string categoriesNames, int page = 1) { var materialsCategoriesDic = categoriesCache.GetAllCategoriesIncludeSub(categoriesNames); IList <CategoryCached> categoriesList = authorizationService.GetAllowedCategories(User.Roles, materialsCategoriesDic.Values, OperationKeys.MaterialAndCommentsRead); if (categoriesList.Count == 0) { return(BadRequest("No categories to show")); } var categoriesIds = categoriesList.Select(x => x.Id).ToArray(); IPagedList <ArticleInfoView> articles = await articlesPresenter.GetArticlesFromMultiCategoriesAsync(categoriesIds, page, articlesOptions.CategoryPageSize); return(Json(articles)); }
public virtual async Task <IActionResult> GetArticlesFromMultiCategories(string categoriesNames, int page = 1) { var materialsCategoriesDic = categoriesCache.GetAllCategoriesWithChildren(categoriesNames); IList <CategoryCached> categoriesList = authorizationService.GetAllowedCategories(User.Roles, materialsCategoriesDic.Values, OperationKeys.MaterialAndCommentsRead); if (categoriesList.Count == 0) { return(BadRequest("No categories to show")); } var options = new MaterialsMultiCatShowOptions { CategoriesIds = categoriesList.Select(x => x.Id), Page = page, PageSize = articlesOptions.CurrentValue.CategoryPageSize }; IPagedList <ArticleInfoView> articles = await articlesPresenter.GetArticlesFromMultiCategoriesAsync(options); return(Json(articles)); }