public JsonResult CreateCodes(Repository.Domain.Module module)
        {
            _moduelApp.Add(module);
            List <ModuleElement> elements = new List <ModuleElement>()
            {
                new ModuleElement {
                    ModuleId = module.Id, Name = "新增", DomId = "btnAdd", Class = "layui-btn-normal", Sort = 1
                },
                new ModuleElement {
                    ModuleId = module.Id, Name = "删除", DomId = "btnDel", Class = "layui-btn-danger", Sort = 1
                },
                new ModuleElement {
                    ModuleId = module.Id, Name = "编辑", DomId = "btnEdit", Class = "layui-btn-normal", Sort = 1
                },
            };

            elements.ForEach(m => {
                _moduelApp.AddMenu(m);
            });
            ICollection <string> formKeys = Request.ReadFormAsync().Result.Keys;
            List <string>        list     = new List <string>();

            foreach (string item in formKeys)
            {
                list.Add(item);
            }
            string entityName = Request.Form["entityName"];

            CreateCodeFiles(entityName, list);
            Result.Code    = 200;
            Result.Message = "生成成功";
            return(Json(Result));
        }
示例#2
0
 public string Add(Module model)
 {
     try
     {
         _app.Add(model);
     }
     catch (Exception ex)
     {
         Result.Code    = 500;
         Result.Message = ex.Message;
     }
     return(JsonHelper.Instance.Serialize(Result));
 }
示例#3
0
        public Response <Module> Add(Module obj)
        {
            var result = new Response <Module> ();

            try {
                _app.Add(obj);
                result.Result = obj;
            } catch (Exception ex) {
                result.Code    = 500;
                result.Message = ex.InnerException?.Message ?? ex.Message;
            }

            return(result);
        }
示例#4
0
 public string Add(Module model)
 {
     try
     {
         if (string.IsNullOrEmpty(model.ParentId))
         {
             model.ParentId = Guid.Empty.ToString();
         }
         _app.Add(model);
     }
     catch (Exception ex)
     {
         Result.Code    = 500;
         Result.Message = ex.InnerException?.Message ?? ex.Message;
     }
     return(JsonHelper.Instance.Serialize(Result));
 }