示例#1
0
        public ActionResult Edit(ProductViewModel product, HttpPostedFileBase Image)
        {
            if (!ModelState.IsValid)
            {
                ViewBag.Categroies = categroyAppService.GetAllCategroy();
                return(View(product));
            }
            if (Image != null)
            {
                string fileName = Path.GetFileName(Image.FileName);
                product.Image = fileName;
                Image.SaveAs(Server.MapPath("~/Content/image/") + fileName);
            }

            productAppService.UpdateProduct(product);
            return(RedirectToAction("Index"));
        }