public JsonResult GetSubCategory(int selectedValue) { IRepositoryBase <ProductSubCategory> repositorySubCategory = new ProductSubCategoryRepository(); var items = repositorySubCategory.GetAll().Where(x => x.ProductCategoryID == selectedValue).ToList(); return(Json(items, JsonRequestBehavior.AllowGet)); }
public ActionResult Edit(int id) { var product = repository.GetByID(id); GetProduct(product); ViewBag.ProductModelID = product.ProductModelId; IRepositoryBase <ProductSubCategory> repositorySubCategory = new ProductSubCategoryRepository(); ViewBag.ProductCategoryID = repositorySubCategory.GetAll().Where(x => x.ProductSubCategoryID == product.ProductSubCategoryID).Select(y => y.ProductCategoryID).FirstOrDefault(); ViewBag.ProductSubCategoryID = product.ProductSubCategoryID; return(View(product)); }
public Product GetProduct(Product product) { IRepositoryBase <ProductCategory> repositoryCategory = new ProductCategoryRepository(); product.ProductCategoryCollection = repositoryCategory.GetAll().ToList(); IRepositoryBase <ProductSubCategory> repositorySubCategory = new ProductSubCategoryRepository(); product.ProductSubCategoryCollection = repositorySubCategory.GetAll().ToList(); IRepositoryBase <ProductModel> repositoryProductModel = new ProductModelRepository(); product.ProductModelCollection = repositoryProductModel.GetAll().ToList(); return(product); }