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")); }
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")); }
public ActionResult RemoveProduct(Product product) { ProductDataAcess.DeleteProduct(product); return(RedirectToAction("Management")); }
public ActionResult Management() { ViewData["ProdutsList"] = ProductDataAcess.GetListProductByStoreID(1); return(View("Management")); }