Exemple #1
0
        public async Task <string> AddOrModifyAsync([FromForm] DataTable model)
        {
            BaseResult baseResult = new BaseResult();

            try
            {
                if (model != null)
                {
                    if (!string.IsNullOrWhiteSpace(model.StableName) && model.IdataBaseId > 0)
                    {
                        if (await _dataTableService.AddOrModifyDataTableAsync(model, User.Identity.Name) != null)
                        {
                            baseResult.Code = 0;
                            baseResult.Msg  = "操作成功!";
                        }
                        else
                        {
                            baseResult.Code = 1;
                            baseResult.Msg  = "操作失败!";
                        }
                    }
                    else
                    {
                        baseResult.Code = 3;
                        baseResult.Msg  = "控制器名称不能为空!";
                    }
                }
            }
            catch (Exception ex)
            {
                baseResult.Code = 3;
                baseResult.Msg  = ex.Message;
            }
            return(JsonHelper.ObjectToJSON(baseResult));
        }