public ActionResult AddFlowersPhotoInfo(Model.FlowerChange FlowerChange) { try { HttpPostedFileBase file = Request.Files["attach_paths"]; FlowerChange.ChangePhoto = Utility.ChangeText.SaveUploadPicture(file, "changeaf"); Business.Sys_FlowerChange Sys_FlowerChange = new Business.Sys_FlowerChange(); Utility.Log.WriteTextLog("补图", "ID", Request["Number"], "路径", FlowerChange.ChangePhoto); if (Sys_FlowerChange.AddFlowerPhotoInfo(Request["Number"], FlowerChange.ChangePhoto)) { ViewData["success"] = "操作成功"; } } catch (Exception ex) { Utility.Log.WriteTextLog("补图", "", "", "", ex.ToString()); } return(View()); }
public ActionResult Upload() { try { string FlowerChangeId = Request["FlowerChangeId"]; HttpPostedFileBase files = Request.Files["file"]; Business.Sys_FlowerChange Sys_FlowerChange = new Business.Sys_FlowerChange(); string strwhere = " and id=" + FlowerChangeId + ""; List <Model.FlowerChange> list = Sys_FlowerChange.GetFlowerChange(strwhere); Model.FlowerChange FlowerChange = list.Count > 0 ? list[0] : new Model.FlowerChange(); if (FlowerChange.ChangePhoto != null) { DeleteFlowerPhoto(FlowerChange.ChangePhoto); } FlowerChange.ChangePhoto = Utility.ChangeText.SaveUploadPicture(files, "attach"); Sys_FlowerChange.AddFlowerPhotoInfo(FlowerChange.Number, FlowerChange.ChangePhoto); return(Json(new { result = "OK", msg = "更换花卉成功" }, "text/html", JsonRequestBehavior.AllowGet)); } catch (Exception ex) { Utility.Log.WriteTextLog("报错", "FlowerChange", "upload", "后台提交更换后的图片", ""); return(null); } }