Use ListResultDto as return value.

pull/2985/head
maliming 6 years ago
parent ed5ebe3203
commit fb3a0f6c57

@ -8,7 +8,7 @@ namespace Volo.Abp.Identity
{ {
public interface IIdentityRoleAppService : IApplicationService public interface IIdentityRoleAppService : IApplicationService
{ {
Task<List<IdentityRoleDto>> GetAllListAsync(); Task<ListResultDto<IdentityRoleDto>> GetAllListAsync();
Task<PagedResultDto<IdentityRoleDto>> GetListAsync(PagedAndSortedResultRequestDto input); Task<PagedResultDto<IdentityRoleDto>> GetListAsync(PagedAndSortedResultRequestDto input);

@ -27,10 +27,11 @@ namespace Volo.Abp.Identity
await _roleManager.GetByIdAsync(id)); await _roleManager.GetByIdAsync(id));
} }
public virtual async Task<List<IdentityRoleDto>> GetAllListAsync() public virtual async Task<ListResultDto<IdentityRoleDto>> GetAllListAsync()
{ {
var list = await _roleRepository.GetListAsync(); var list = await _roleRepository.GetListAsync();
return ObjectMapper.Map<List<IdentityRole>, List<IdentityRoleDto>>(list); return new ListResultDto<IdentityRoleDto>(
ObjectMapper.Map<List<IdentityRole>, List<IdentityRoleDto>>(list));
} }
public virtual async Task<PagedResultDto<IdentityRoleDto>> GetListAsync(PagedAndSortedResultRequestDto input) public virtual async Task<PagedResultDto<IdentityRoleDto>> GetListAsync(PagedAndSortedResultRequestDto input)

@ -22,7 +22,7 @@ namespace Volo.Abp.Identity
[HttpGet] [HttpGet]
[Route("all")] [Route("all")]
public virtual Task<List<IdentityRoleDto>> GetAllListAsync() public virtual Task<ListResultDto<IdentityRoleDto>> GetAllListAsync()
{ {
return _roleAppService.GetAllListAsync(); return _roleAppService.GetAllListAsync();
} }

@ -29,7 +29,7 @@ namespace Volo.Abp.Identity.Web.Pages.Identity.Users
{ {
UserInfo = new UserInfoViewModel(); UserInfo = new UserInfoViewModel();
var roleDtoList = await _identityRoleAppService.GetAllListAsync(); var roleDtoList = (await _identityRoleAppService.GetAllListAsync()).Items;
Roles = ObjectMapper.Map<IReadOnlyList<IdentityRoleDto>, AssignedRoleViewModel[]>(roleDtoList); Roles = ObjectMapper.Map<IReadOnlyList<IdentityRoleDto>, AssignedRoleViewModel[]>(roleDtoList);

@ -31,7 +31,7 @@ namespace Volo.Abp.Identity.Web.Pages.Identity.Users
{ {
UserInfo = ObjectMapper.Map<IdentityUserDto, UserInfoViewModel>(await _identityUserAppService.GetAsync(id)); UserInfo = ObjectMapper.Map<IdentityUserDto, UserInfoViewModel>(await _identityUserAppService.GetAsync(id));
Roles = ObjectMapper.Map<IReadOnlyList<IdentityRoleDto>, AssignedRoleViewModel[]>((await _identityRoleAppService.GetAllListAsync())); Roles = ObjectMapper.Map<IReadOnlyList<IdentityRoleDto>, AssignedRoleViewModel[]>((await _identityRoleAppService.GetAllListAsync()).Items);
var userRoleNames = (await _identityUserAppService.GetRolesAsync(UserInfo.Id)).Items.Select(r => r.Name).ToList(); var userRoleNames = (await _identityUserAppService.GetRolesAsync(UserInfo.Id)).Items.Select(r => r.Name).ToList();
foreach (var role in Roles) foreach (var role in Roles)

@ -43,7 +43,7 @@ namespace Volo.Abp.Identity
//Assert //Assert
result.Count.ShouldBeGreaterThan(0); result.Items.Count.ShouldBeGreaterThan(0);
} }
[Fact] [Fact]

Loading…
Cancel
Save