public async Task <IViewComponentResult> InvokeAsync()
        {
            var articles = await _articleContext.GetArticles(true, null, null);

            var categories = await _categoryContext.GetCategories(true);

            articles.ForEach(c => c.Badge = categories.Exists(a => a.Id == c.CategoryId) ?  categories.First(a => a.Id == c.CategoryId && a.Display == true) : null);

            return(View("~/Views/Components/ContentPreview.cshtml", articles));
        }
        public async Task <IViewComponentResult> InvokeAsync(string selectedCategory)
        {
            var category = await _categoryContext.GetCategories(null);

            category.ForEach(c => c.Selected = false);

            if (!string.IsNullOrEmpty(selectedCategory))
            {
                category.Find(c => c.Id == selectedCategory).Selected = true;
            }

            return(View("~/Views/Components/_CategoriesDropDownPartial.cshtml", category));
        }
예제 #3
0
        public async Task <IViewComponentResult> InvokeAsync()
        {
            var category = await _categoryContext.GetCategories(true);

            return(View("~/Views/Components/_CategoriesMenuPartial.cshtml", category));
        }
예제 #4
0
 public List <CategoryModel> GetCategories()
 {
     return(_categoryContext.GetCategories());
 }
예제 #5
0
        public async Task <ActionResult> CategoryList()
        {
            var articles = await _categoryContext.GetCategories(null);

            return(View("Category/Category", articles));
        }