public JsonResult TextMessage_Create(string title, string id, List<WX_MessageGroup> list) { if (new Guid(id) == Guid.Empty) { WX_Message wm = new WX_Message() { ID = Guid.NewGuid(), CreateTime = DateTime.Now }; wm.CompanyID = UserDateTicket.Company.ID; wm.ConfigID = UserDateTicket.wx_config.ID; wm.Title = title; if (WX_MessageService.instance().Insert(wm) == 1) { foreach (var item in list) { Files f = FilesService.instance().Single(item.FilesID); item.MessageID = wm.ID; item.ImgUrl = f.FilePath; item.Content = Server.UrlDecode(item.Content); item.Img_media_id = f.media_id; WX_MessageGroupService.instance().Insert(item); } } } else { WX_MessageGroupService.instance().DeleteByMID(new Guid(id)); WX_Message wm = WX_MessageService.instance().Single(new Guid(id)); wm.media_id = ""; wm.Title = title; WX_MessageService.instance().Update(wm); foreach (var item in list) { Files f = FilesService.instance().Single(item.FilesID); item.MessageID = wm.ID; item.ImgUrl = f.FilePath; item.Img_media_id = f.media_id; item.Content = Server.UrlDecode(item.Content); WX_MessageGroupService.instance().Insert(item); } } return Json("ok", JsonRequestBehavior.AllowGet); }
public ActionResult TextMessage_Create(string id) { WX_Message m; if (string.IsNullOrEmpty(id)) m = new WX_Message(); else m = WX_MessageService.instance().Single(new Guid(id)); return View(m); }