Exemplo n.º 1
0
        public ActionResult AddNewProduct(Product product, HttpPostedFileBase file)
        {
            if (file != null)
            {
                string pic  = Path.GetFileName(file.FileName);
                string path = Path.Combine(Server.MapPath("~/images/product"), pic);
                file.SaveAs(path);
                product.ImgPath = path;
                ProductDataAcess.AddNewProduct(product, 1);
                ViewBag.msg = "Success";
            }

            return(View("AddNew"));
        }
Exemplo n.º 2
0
        public ActionResult UpdateProduct(Product product, HttpPostedFileBase file)
        {
            if (file != null)
            {
                string pic  = Path.GetFileName(file.FileName);
                string path = Path.Combine(Server.MapPath("~/images/product"), pic);
                file.SaveAs(path);
                product.ImgPath = path;
            }

            ProductDataAcess.UpdateProduct(product);

            return(RedirectToAction("Management"));
        }
Exemplo n.º 3
0
 public ActionResult RemoveProduct(Product product)
 {
     ProductDataAcess.DeleteProduct(product);
     return(RedirectToAction("Management"));
 }
Exemplo n.º 4
0
 public ActionResult Management()
 {
     ViewData["ProdutsList"] = ProductDataAcess.GetListProductByStoreID(1);
     return(View("Management"));
 }