AuthorityManagement.Web.Controllers.RoleManagerController.SaveRole C# (CSharp) Method

SaveRole() private method

private SaveRole ( RoleInputDto roleInput ) : System.Web.Mvc.ActionResult
roleInput RoleInputDto
return System.Web.Mvc.ActionResult
        public ActionResult SaveRole(RoleInputDto roleInput)
        {
            if (!ModelState.IsValid)
            {
                return this.Json(OperationResult.Error("输入值有错误"));
            }

            try
            {
                if (roleInput.Id == Guid.Empty)
                {
                    this.roleService.Add(roleInput);
                }
                else
                {
                    this.roleService.Update(roleInput);
                }

                return this.Json(OperationResult.Success("保存成功"));
            }
            catch (Exception e)
            {
                return this.Json(OperationResult.Error("保存失败," + e.Message));
            }
        }