public async Task <TData <List <KeyValue> > > CodeGenerateJson([FromForm] BaseConfigModel baseConfig)
        {
            var obj = new TData <List <KeyValue> >();

            var result = await _singleTableTemplate.CreateCode(baseConfig, HttpUtility.UrlDecode(baseConfig.Code));

            obj.Data = result;
            obj.Tag  = 1;

            return(obj);
        }
        public IActionResult CodeGenerateJson(BaseConfigModel baseConfig, string Code)
        {
            TData <List <KeyValue> > obj = new TData <List <KeyValue> >();

            if (!GlobalContext.SystemConfig.Debug)
            {
                obj.Message = "请在本地开发模式时使用代码生成";
            }
            else
            {
                SingleTableTemplate template = new SingleTableTemplate();
                List <KeyValue>     result   = template.CreateCode(baseConfig, HttpUtility.UrlDecode(Code));
                obj.Result = result;
                obj.Tag    = 1;
            }
            return(Json(obj));
        }
Esempio n. 3
0
 public async Task <ActionResult> CodeGenerateJson(BaseConfigModel baseConfig, string Code)
 {
     try
     {
         if (!GlobalContext.SystemConfig.Debug)
         {
             throw new System.Exception("请在本地开发模式时使用代码生成");
         }
         else
         {
             SingleTableTemplate template = new SingleTableTemplate(_context);
             await template.CreateCode(baseConfig, HttpUtility.UrlDecode(Code));
         }
         return(await Success("操作成功。", "", ""));
     }
     catch (System.Exception ex)
     {
         return(await Error(ex.Message, "", ""));
     }
 }