コード例 #1
0
        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 AddMenu(ModuleElement model)
 {
     try
     {
         _app.AddMenu(model);
     }
     catch (Exception ex)
     {
         Result.Code    = 500;
         Result.Message = ex.Message;
     }
     return(JsonHelper.Instance.Serialize(Result));
 }
コード例 #3
0
        public Response <ModuleElement> AddMenu(ModuleElement obj)
        {
            var result = new Response <ModuleElement> ();

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

            return(result);
        }