/// <summary> /// 保存报事照片 /// </summary> /// <returns></returns> public ActionResult OnSetPatrolImage() { StatusReport sr = new StatusReport(); if (Request.Files.Count == 0) { sr.status = "Fail"; sr.result = "没有图片"; return(Json(sr)); } try { string imagePath = Config.patrolImageMainPath + Request.Files.AllKeys[0]; string sqlImagePath = Request.Files.AllKeys[0]; HttpPostedFileBase uploadImage = (Request.Files[0]); uploadImage.SaveAs(imagePath); string ID = Request.Form["id"]; //string func = Request.Form["func"];//a string index = Request.Form["index"]; sr = PatrolDal.SetPatrolImage(ID, index, sqlImagePath); return(Json(sr)); } catch (NotImplementedException exp) { sr.status = "Fail"; sr.result = exp.Message; return(Json(sr)); } }
public ActionResult OnSetPatrolImages() { StatusReport sr = new StatusReport(); if (Request.Files.Count == 0) { sr.status = "Fail"; sr.result = "没有图片"; return(Json(sr)); } string ID = Request.Form["id"]; string index = Request.Form["index"]; string fileName = Request.Files.AllKeys[0]; sr = PatrolDal.SetPatrolImage(ID, index, fileName); sr = SetImage(Request); return(Json(sr)); }