//
        // GET: /Product/Edit/5
        public ActionResult Edit(int id)
        {
            var product = _productRepo.Get(id);
            var vm = new ProductEditViewModel
            {
                Product = product,
                CategoryID = product.Category.ParentID.HasValue
                                        ? product.Category.ParentID.Value
                                        : 0,
                Categories = _categoryRepo.GetSelectListForCategories(),
                SubCategoryID = product.CategoryID,
                Subcategories = _categoryRepo.GetSelectListForCategories(product.CategoryID)
            };

            return View(vm);
        }
 public ActionResult Edit(ProductEditViewModel vm)
 {
     if (ModelState.IsValid)
     {
         vm.Product.CategoryID = vm.SubCategoryID;
         _productRepo.Save(vm.Product);
         return RedirectToAction("Index");
     }
     return View(vm);
 }