From fb3a0f6c578862a41044f3454256a673060246a4 Mon Sep 17 00:00:00 2001 From: maliming Date: Sun, 8 Mar 2020 18:58:05 +0800 Subject: [PATCH] Use ListResultDto as return value. --- .../Volo/Abp/Identity/IIdentityRoleAppService.cs | 2 +- .../Volo/Abp/Identity/IdentityRoleAppService.cs | 5 +++-- .../Volo/Abp/Identity/IdentityRoleController.cs | 2 +- .../Pages/Identity/Users/CreateModal.cshtml.cs | 2 +- .../Pages/Identity/Users/EditModal.cshtml.cs | 2 +- .../Volo/Abp/Identity/IdentityRoleAppService_Tests.cs | 2 +- 6 files changed, 8 insertions(+), 7 deletions(-) diff --git a/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IIdentityRoleAppService.cs b/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IIdentityRoleAppService.cs index 7096b44127..9381a9b2c8 100644 --- a/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IIdentityRoleAppService.cs +++ b/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IIdentityRoleAppService.cs @@ -8,7 +8,7 @@ namespace Volo.Abp.Identity { public interface IIdentityRoleAppService : IApplicationService { - Task> GetAllListAsync(); + Task> GetAllListAsync(); Task> GetListAsync(PagedAndSortedResultRequestDto input); diff --git a/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityRoleAppService.cs b/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityRoleAppService.cs index a07f4d7c89..b02319bc24 100644 --- a/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityRoleAppService.cs +++ b/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityRoleAppService.cs @@ -27,10 +27,11 @@ namespace Volo.Abp.Identity await _roleManager.GetByIdAsync(id)); } - public virtual async Task> GetAllListAsync() + public virtual async Task> GetAllListAsync() { var list = await _roleRepository.GetListAsync(); - return ObjectMapper.Map, List>(list); + return new ListResultDto( + ObjectMapper.Map, List>(list)); } public virtual async Task> GetListAsync(PagedAndSortedResultRequestDto input) diff --git a/modules/identity/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/IdentityRoleController.cs b/modules/identity/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/IdentityRoleController.cs index e1efff89fa..9925d18abb 100644 --- a/modules/identity/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/IdentityRoleController.cs +++ b/modules/identity/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/IdentityRoleController.cs @@ -22,7 +22,7 @@ namespace Volo.Abp.Identity [HttpGet] [Route("all")] - public virtual Task> GetAllListAsync() + public virtual Task> GetAllListAsync() { return _roleAppService.GetAllListAsync(); } diff --git a/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/CreateModal.cshtml.cs b/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/CreateModal.cshtml.cs index 6a5e4f8218..6c1ac1ff72 100644 --- a/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/CreateModal.cshtml.cs +++ b/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/CreateModal.cshtml.cs @@ -29,7 +29,7 @@ namespace Volo.Abp.Identity.Web.Pages.Identity.Users { UserInfo = new UserInfoViewModel(); - var roleDtoList = await _identityRoleAppService.GetAllListAsync(); + var roleDtoList = (await _identityRoleAppService.GetAllListAsync()).Items; Roles = ObjectMapper.Map, AssignedRoleViewModel[]>(roleDtoList); diff --git a/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/EditModal.cshtml.cs b/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/EditModal.cshtml.cs index b277f0b5c7..98a32fd1bd 100644 --- a/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/EditModal.cshtml.cs +++ b/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/EditModal.cshtml.cs @@ -31,7 +31,7 @@ namespace Volo.Abp.Identity.Web.Pages.Identity.Users { UserInfo = ObjectMapper.Map(await _identityUserAppService.GetAsync(id)); - Roles = ObjectMapper.Map, AssignedRoleViewModel[]>((await _identityRoleAppService.GetAllListAsync())); + Roles = ObjectMapper.Map, AssignedRoleViewModel[]>((await _identityRoleAppService.GetAllListAsync()).Items); var userRoleNames = (await _identityUserAppService.GetRolesAsync(UserInfo.Id)).Items.Select(r => r.Name).ToList(); foreach (var role in Roles) diff --git a/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/IdentityRoleAppService_Tests.cs b/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/IdentityRoleAppService_Tests.cs index 4cdf590f38..5d64bb6c78 100644 --- a/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/IdentityRoleAppService_Tests.cs +++ b/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/IdentityRoleAppService_Tests.cs @@ -43,7 +43,7 @@ namespace Volo.Abp.Identity //Assert - result.Count.ShouldBeGreaterThan(0); + result.Items.Count.ShouldBeGreaterThan(0); } [Fact]