public ActionResult Edit(ProductViewModel prod, HttpPostedFileBase upload) { if (!ModelState.IsValid) { return(PartialView(prod)); } _service.EditProduct(prod); if (upload != null) { string fileName = HttpContext.Server.MapPath(ConfigurationManager.AppSettings["ImageFolder"]) + prod.Image; if (System.IO.File.Exists(fileName)) { System.IO.File.Delete(fileName); } upload.SaveAs(fileName); } string path = HttpContext.Request.UrlReferrer.AbsolutePath; return(Content(path)); }
public IHttpActionResult Put(ProductViewModel prod) { _service.EditProduct(prod); return(Ok()); }