public ActionResult Edit(int productId)
 {
     try
     {
         User staffUser = Session["User"] as User;
         if (staffUser == null || Session["UserRole"] == null || (int)Session["UserRole"] == 3)
         {
             return RedirectToAction("Index", "Home");
         }
         if ((int)Session["UserRole"] == 1)
         {
             return RedirectToAction("Index", "StoreInfor");
         }
         ViewBag.TreeView = "product";
         ViewBag.TreeViewMenu = "productList";
         ManageProductBusiness mpb = new ManageProductBusiness();
         var product = mpb.GetProductDetail(productId);
         var materialList = mpb.GetListMaterial(productId);
         var category = mpb.GetCategory();
         Policy maxPricePolicy = db.Policies.SingleOrDefault(n => n.PolicyId == 2);
         int maxPrice = maxPricePolicy.PolicyBound;
         ViewBag.maxPrice = maxPrice;
         ViewBag.materialList = materialList;
         ViewBag.category = category;
         if (product == null)
         {
             return HttpNotFound();
         }
         InitiateMaterialList(productId);
         return View(product);
     }
     catch
     {
         return RedirectToAction("ManageError", "Error");
     }
 }
 public ActionResult ProductMaterial(int productId)
 {
     ManageProductBusiness mpb = new ManageProductBusiness();
     var productMaterial = mpb.GetListMaterial(productId);
     var product = mpb.GetProductDetail(productId);
     ViewBag.productName = product.ProductName;
     ViewBag.productId = product.ProductId;
     return View(productMaterial);
 }
 public ActionResult Detail(int productId)
 {
     try
     {
         if (Session["User"] == null || Session["UserRole"] == null)
         {
             return RedirectToAction("Index", "Home");
         }
         ViewBag.TreeView = "product";
         ViewBag.TreeViewMenu = "productList";
         ManageProductBusiness mpb = new ManageProductBusiness();
         var product = mpb.GetProductDetail(productId);
         var productMaterial = mpb.GetListMaterial(productId);
         ViewBag.ProductMaterial = productMaterial;
         return View(product);
     }
     catch
     {
         return RedirectToAction("ManageError", "Error");
     }
 }