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));
        }
Ejemplo n.º 2
0
        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));
        }
Ejemplo n.º 3
0
 public object UpdateBrand(String id, BrandReq req)
 {
     return(brandRep.Update(id, req));
 }
Ejemplo n.º 4
0
 //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));
 }