예제 #1
0
        public ActionResult Create(NewRoleViewModel newRoleModel)
        {
            ControllerResult result = ControllerResult.SuccResult;

            Role role = new Role()
            {
                Name        = newRoleModel.RoleName,
                Description = newRoleModel.RoleDesc,
                Code        = newRoleModel.RoleCode
            };

            string errorMsg = string.Empty;

            bool addResult = roleService.AddNewRole(role, out errorMsg);

            if (!addResult)
            {
                result         = ControllerResult.FailResult;
                result.ErroMsg = errorMsg;
            }
            else
            {
                LogUserAction("进行新增角色操作,角色名称{0},角色编码{1}".Fmt(newRoleModel.RoleName, newRoleModel.RoleCode));
            }
            return(Content(result.ToJson()));
        }