public async Task <PageList <RoleDto> > GetRolesAsync(String roleName, Int32 pageIndex, Int32 pageSize) { return(await Task.Run(() => { var result = _securityContext.GetRoles(roleName, pageIndex, pageSize, out var totalCount); return new PageList <RoleDto> { TotalCount = totalCount, Models = result.Select(s => new RoleDto { Name = s.Name, Id = s.Id, RoleIdentity = s.RoleIdentity }).ToList() }; })); }