public string Create(dynamic requestData) { LogHelper.WriteMsgByDay("BanKuaiController-Create-log:" + requestData.ToString()); ReturnJson r = new ReturnJson(); string bankuainame = requestData.BanKuaiName; if (bankuainame.Length > 0 && bankuainame.Length <= 14) { string sql = string.Format(@"SELECT * FROM dbo.CpkBanKuai WHERE BanKuaiName = '{0}'", bankuainame); int count = SqlHelper2.GetCountByCountSql(sql); if (count == 0) { sql = string.Format(@"INSERT INTO dbo.CpkBanKuai( BanKuaiName )VALUES ('{0}')", bankuainame); dataContext.ExecuteNonQuery(CommandType.Text, sql); r.status = "succ"; r.message = "创建成功"; } else { r.message = "该板块已存在"; } } else if (bankuainame.Length > 14) { r.message = "板块名称长度已超过14"; } else { r.message = "BanKuaiName不能为空"; } return(JsonConvert.SerializeObject(r)); }