Пример #1
0
        public async Task <IActionResult> InitCreateNewRoleAsync(Int32 roleId = 0)
        {
            var     response = new ResponseModel <dynamic>();
            RoleDto roleDto  = null;

            if (roleId != 0)
            {
                roleDto = await _securityServices.GetRoleAsync(roleId);

                if (roleDto == null)
                {
                    response.IsSuccess = false;
                    response.Message   = "角色初始化失败";
                    return(Json(response));
                }
            }
            var userContext = await GetUserContextAsync();

            var uniqueToken = CreateUniqueTokenAsync(userContext.Id);

            response.Model     = new { roleDto, uniqueToken };
            response.IsSuccess = true;
            response.Message   = "创建新角色初始化成功";
            return(Json(response));
        }