public IActionResult Index() { List <Category> categories = subCategoryService.GetCategories().ToList(); return(View(new IndexViewModel() { CategorySelectListItems = Dropdown.From(categories) })); }
public async Task <IViewComponentResult> InvokeAsync(int CategoryId) { List <Category> categories = subCategoryService.GetCategories().ToList(); return(View(ViewComponentPath.ViewPath("SubCategory", "_SubCategoryTable"), new SubCategoriesTableViewModel { CategorySelectListItems = Dropdown.From(categories), CategoryId = CategoryId, SubCategories = subCategoryService.GetSubcategoriesByCategoryID(CategoryId).ToList() })); }