public ActionResult EditBrand(Brand model, HttpPostedFileBase PhotoPath) { string PhotoName = model.Photo; string path = ""; if (PhotoPath != null) { PhotoName = Guid.NewGuid().ToString().Replace("-", "") + ".jpg"; string fullPath = Request.MapPath("~/Upload/Brand/" + model.Photo); path = Server.MapPath("~/Upload/Brand/" + PhotoName); model.Photo = PhotoName; PhotoPath.SaveAs(path); //img deleting if (System.IO.File.Exists(fullPath)) { System.IO.File.Delete(fullPath); } } //update result.resultint = br.Update(model); if (result.resultint.IsSucceded) { return(RedirectToAction("List")); } return(View(model)); }
public ActionResult Edit(Brand model, HttpPostedFileBase PhotoPath) { string PhotoName = model.Photo; if (PhotoPath.ContentLength > 0 & PhotoPath != null) { PhotoName = Guid.NewGuid().ToString().Replace("-", "") + ".jpg"; string path = Server.MapPath("~/Upload/" + PhotoName); PhotoPath.SaveAs(path); } model.Photo = PhotoName; result.resultint = br.Update(model); if (result.resultint.IsSuccessed) { return(RedirectToAction("List")); } return(View(model)); }
public object UpdateBrand(String id, BrandReq req) { return(brandRep.Update(id, req)); }
//Sửa public object UpdateBrand(String id, BrandReq req) { //Gán giá trị vào bảng //Trả về giá trị return(_rep.Update(id, req)); }