public ActionResult GetSubCategoryDropDownList(int id) { IEcommerceManagerFacade employeeFacade = (IEcommerceManagerFacade)FacadeFactory.Instance.Create(FacadeType.EcommerceManager); IList <OperationResult <ISubCategoriesDTO> > result = employeeFacade.GetAllSubCategories(id); List <SelectListItem> listCategories = new List <SelectListItem>(); foreach (OperationResult <ISubCategoriesDTO> emp in result) { if (emp.IsValid()) { listCategories.Add(new SelectListItem { Text = emp.Data.SubCategoryName, Value = emp.Data.SubCategotyId + "" }); } } return(new JsonResult() { Data = listCategories, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); }
public ActionResult GetAllSubCategories(int id) { IList <SubCategory> retVal = new List <SubCategory>(); IEcommerceManagerFacade employeeFacade = (IEcommerceManagerFacade)FacadeFactory.Instance.Create(FacadeType.EcommerceManager); IList <OperationResult <ISubCategoriesDTO> > result = employeeFacade.GetAllSubCategories(id); if (result.Count() > 0) { foreach (OperationResult <ISubCategoriesDTO> emp in result) { if (emp.IsValid()) { SubCategory tempEmp = new SubCategory(); tempEmp.CategotyId = emp.Data.CategotyId; tempEmp.SubCategoryName = emp.Data.SubCategoryName; tempEmp.SubCategotyId = emp.Data.SubCategotyId; retVal.Add(tempEmp); } } } return(View(retVal)); }