public ActionResult Delete(int ID) { ResearchNoteAttachmentInfo info = ResearchNoteAttachmentBLL.GetList(a => a.ID == ID).FirstOrDefault(); if (null == info) { return(Json(new APIJson("数据不存在"))); } var infoResearch = info.ResearchNoteInfo.ResearchInfo; int ResearchNoteID = info.ResearchNoteID; if (infoResearch.Status == (int)SysEnum.ResearchStatus.已确认) { return(Json(new APIJson(-1, "当前状态不能上传"))); } string MineType = info.MineType; try { System.IO.File.Delete(Server.MapPath(info.PathRelative + info.Name)); } catch (Exception) {} if (ResearchNoteAttachmentBLL.Delete(info)) { var infoResearchNoteDb = ResearchNoteBLL.GetList(a => a.ID == ResearchNoteID).FirstOrDefault(); var result = new { listImage = ResearchNoteAttachmentBLL.GetImageJSON(infoResearchNoteDb, "image"), listAudio = ResearchNoteAttachmentBLL.GetImageJSON(infoResearchNoteDb, "audio") }; return(Json(new APIJson(0, "删除成功", result))); } return(Json(new APIJson("删除失败,请重试"))); }
public ActionResult Create(ResearchNoteAttachmentInfo info) { ResearchNoteInfo infoResearchNote = ResearchNoteBLL.GetList(a => a.ID == info.ResearchNoteID).FirstOrDefault(); if (null == infoResearchNote) { return(Json(new APIJson(-1, "数据有误,找不到课堂记录对象"))); } if (infoResearchNote.ResearchInfo.Status == (int)SysEnum.ResearchStatus.已确认) { return(Json(new APIJson(-1, "当前状态不能上传"))); } if (string.IsNullOrEmpty(info.MineType)) { info.MineType = "image"; } string SavePathRelative = SaveWechatImage(info.Name, info.MineType, infoResearchNote.ResearchInfo); info.Name = SavePathRelative.Substring(SavePathRelative.LastIndexOf("/") + 1); info.PathRelative = SavePathRelative.Substring(0, SavePathRelative.LastIndexOf("/") + 1); info.CreateDate = DateTime.Now; if (ResearchNoteAttachmentBLL.Create(info).ID > 0) { return(Json(new APIJson(0, "提交成功", ResearchNoteAttachmentBLL.GetImageJSON(infoResearchNote, info.MineType)))); } return(Json(new APIJson(-1, "提交失败,请重试"))); }
public ActionResult Delete(int id) { var info = ResearchNoteBLL.GetList(p => p.ID == id).FirstOrDefault(); if (null == info) { return(Json(new APIJson(-1, "删除失败,参数有误"))); } if (ResearchNoteBLL.Delete(info)) { return(Json(new APIJson(0, "删除成功"))); } return(Json(new APIJson(-1, "删除失败,请重试"))); }
public ActionResult Edit(ResearchNoteInfo info) { ResearchNoteInfo infoExist = ResearchNoteBLL.GetList(a => a.ID == info.ID).FirstOrDefault(); if (null == infoExist) { return(Json(new APIJson(-1, "数据有误,找不到课堂记录对象"))); } if (null == info.Detail) { info.Detail = string.Empty; } infoExist.Detail = info.Detail; if (ResearchNoteBLL.Edit(infoExist)) { return(Json(new APIJson(0, "提交成功"))); } return(Json(new APIJson(-1, "提交失败,请重试"))); }