public async Task <IActionResult> RoleMenu([FromForm] string id, List <MenuButtonAttributes> menuButtonAttributes) { var result = new Result { code = (int)StatusCodeEnum.Success, msg = StatusCodeEnum.Success.GetEnumText() }; Guid gid; if (!Guid.TryParse(id, out gid)) { result.code = (int)StatusCodeEnum.HttpMehtodError; result.msg = StatusCodeEnum.HttpMehtodError.GetEnumText(); return(Json(result)); } if (!menuButtonAttributes.Any()) { result.code = (int)StatusCodeEnum.ParameterError; result.msg = StatusCodeEnum.ParameterError.GetEnumText(); return(Json(result)); } var getRoleResult = await _roleServices.GetAsync(gid); if (getRoleResult.data == null) { result.code = (int)StatusCodeEnum.Unauthorized; result.msg = StatusCodeEnum.Unauthorized.GetEnumText(); return(Json(result)); } var getAuthorizeResult = await _roleServices.AuthorizeAsync(new RoleMenuPara { RoleId = gid, MenuButtonIds = menuButtonAttributes }); if (getAuthorizeResult.code != 0) { return(Json(getAuthorizeResult)); } return(Json(result)); }