public IActionResult AddSurvey(string title, string brief, string copy) { try { // 表单ID string formId = Guid.NewGuid().ToString(); Formsettings InsertModel = new Formsettings() { FormID = formId, FormNote = brief, FormTitle = title, FormCopyright = copy, FormCreateDate = DateTime.Parse(DateTime.Now.ToShortDateString()), FormStatus = 1, FormCreater = Seesion.UserName }; //给全局的表单ID赋值 var InsertState = HelpFormsettings.Insert(InsertModel); Seesion.FromIds = formId; if (InsertState > 0) { return(Json(ResultMsg.FormatResult(200, Seesion.FromIds, Seesion.UserName))); } return(Json(ResultMsg.FormatResult(0, "数据添加失败", "失败"))); } catch (Exception el) { return(Json(ResultMsg.FormatResult(el))); } }
/// <summary> /// 组合 layui表格 json /// </summary> /// <returns></returns> public IActionResult jsonTable() { List <Formsettings> query = new List <Formsettings>(); query = HelpFormsettings.GetList("FormCreater = '" + User.Identity.Name + "'"); var tableJson = new { count = query.Count(), //总行数 code = 0, //状态码 0 成功 msg = "操作成功", data = query }; return(Json(tableJson)); }