public ActionResult Edit(int id)
        {
            ProductsClient   CC  = new ProductsClient();
            ProductViewModel CVM = new ProductViewModel();

            CVM.product     = CC.find(id);
            ViewBag.TypeID  = new SelectList(db.Product_Type, "TypeID", "Name", CVM.product.TypeID);
            ViewBag.BrandID = new SelectList(db.Brands, "BrandID", "BrandName", CVM.product.BrandID);
            return(View("Edit", CVM));
        }
        public ActionResult Edit(ProductViewModel CVM, HttpPostedFileBase file)
        {
            if (ModelState.IsValid)
            {
                ProductsClient CC = new ProductsClient();
                if (file == null)
                {
                    CVM.product.Pictures = CC.find(CVM.product.Product_ID).Pictures;
                }
                else
                {
                    string ImageName    = Path.GetFileName(file.FileName);
                    string physicalPath = Server.MapPath("~/Product_Images/" + ImageName);

                    // save image in folder
                    file.SaveAs(physicalPath);
                    CVM.product.Pictures = ImageName;
                }
                int Storeid = CC.Storeid(Convert.ToInt32(Session["userID"]));
                CVM.product.Store_ID = Storeid;
                CC.Edit(CVM.product);
            }
            return(RedirectToAction("Index"));
        }