public async Task <JsonResult> GetSubCategories(int id) { List <SubCategory> subCategories = new List <SubCategory>(); subCategories = await _subCategoryService.GetListByFilterAsync(x => x.CategoryId == id); return(Json(new SelectList(subCategories, "Id", "Name"))); }
public async Task <IViewComponentResult> InvokeAsync() { var category = await _categoryService.GetByFilterAsync(x => x.Name == "Blog"); var blogCategory = await _subCategoryService.GetListByFilterAsync(x => x.CategoryId == category.Id); return(View(_mapper.Map <List <SubCategoryListDto> >(blogCategory))); }
public JsonResult GetSubCategories(int id) { var list = _subCategoryService.GetListByFilterAsync(x => x.CategoryId == id).Result; return(Json(new SelectList(list, "Id", "Name"))); }