public ActionResult Edit(ExchangGifts eGift) { try { HttpPostedFileBase file = Request.Files[0]; string[] cols; if (file.ContentLength > 0) { string fileName = Path.GetFileName(file.FileName); file.SaveAs(Request.MapPath("/Filters/" + fileName)); eGift.EG_Photo = fileName; cols = new string[] { "EG_GiftName", "EG_Photo", "EG_Point", "EG_Number", "EG_Remark" }; } else { cols = new string[] { "EG_GiftName", "EG_Point", "EG_Number", "EG_Remark" }; } ExchangGiftsBLL bll = new ExchangGiftsBLL(); bll.Edit(eGift, cols); bll.SaveChanges(); return Content("ok"); } catch { return Content("error"); } }