コード例 #1
0
 public IActionResult EnableEntities(string data)
 {
     try
     {
         JObject jparam = JsonConvert.DeserializeObject <JObject>(data);
         if (jparam.TryGetValue("tableName", out JToken token))
         {
             var tableName = token.Value <string>();
         }
         List <TableInfo> tables = new List <TableInfo>();
         if (jparam.TryGetValue("where", out JToken where_token))
         {
             if (where_token is JObject where)
             {
                 if (where.TryGetValue("Id", out JToken jids))
                 {
                     if (jids is JArray ids)
                     {
                         foreach (var id in ids)
                         {
                             tables.Add(new TableInfo {
                                 Id = id.Value <int>(), Active = 1
                             });
                         }
                     }
                 }
             }
         }
         var res = _service.DisableEntities(tables);
         return(Ok(new { res.result, res.message }));
     }
     catch
     {
         return(Ok(new { result = false, message = "参数错误,请按照{data:json}的格式传输" }));
     }
 }