public ActionResult AddContent(string name) { var model = new Config_Page { PID = 0, Content = "一级节点", Name = name, Source = "source", Type = 1 }; var configService = new ConfigPageService(); if (configService.Insert(model) > 0) { return Json(new AjaxResponse { State = 1, Message = "添加目录成功" }); } return Json(new AjaxResponse { State = 0, Message = "添加止录失败" }); }
public ActionResult ModifyContent(int ID, string Name, int pid, string Content) { this.configPageService = new ConfigPageService(); if (ID == -1) { var model = new Config_Page { Name = Name, Content = Content, Type = 1, PID = pid, Source = "default" }; if (configPageService.Insert(model) > 0) { return Json(new AjaxResponse { Data = 1, Message = "添加成功" }); } } var received = this.configPageService.UpdateContent(ID, Content, Name); if (received > 0) { // todo : 需要类型参数 return Json(new AjaxResponse { Data = 1, Message = "修改成功" }); } return Json(string.Empty); }