Browse Source

Fallback to default sorting if not provided.

pull/8074/head
Halil İbrahim Kalkan 6 years ago
parent
commit
19854a59eb
  1. 5
      modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityRoleAppService.cs
  2. 5
      modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityUserAppService.cs
  3. 2
      modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityRoleRepository.cs
  4. 2
      modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityUserRepository.cs

5
modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityRoleAppService.cs

@ -39,11 +39,6 @@ namespace Volo.Abp.Identity
public virtual async Task<PagedResultDto<IdentityRoleDto>> GetListAsync(GetIdentityRolesInput input) public virtual async Task<PagedResultDto<IdentityRoleDto>> GetListAsync(GetIdentityRolesInput input)
{ {
if (input.Sorting.IsNullOrWhiteSpace())
{
input.Sorting = nameof(IdentityRole.Name);
}
var list = await RoleRepository.GetListAsync(input.Sorting, input.MaxResultCount, input.SkipCount, input.Filter); var list = await RoleRepository.GetListAsync(input.Sorting, input.MaxResultCount, input.SkipCount, input.Filter);
var totalCount = await RoleRepository.GetCountAsync(input.Filter); var totalCount = await RoleRepository.GetCountAsync(input.Filter);

5
modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityUserAppService.cs

@ -40,11 +40,6 @@ namespace Volo.Abp.Identity
[Authorize(IdentityPermissions.Users.Default)] [Authorize(IdentityPermissions.Users.Default)]
public virtual async Task<PagedResultDto<IdentityUserDto>> GetListAsync(GetIdentityUsersInput input) public virtual async Task<PagedResultDto<IdentityUserDto>> GetListAsync(GetIdentityUsersInput input)
{ {
if (input.Sorting.IsNullOrWhiteSpace())
{
input.Sorting = nameof(IdentityUser.Name);
}
var count = await UserRepository.GetCountAsync(input.Filter); var count = await UserRepository.GetCountAsync(input.Filter);
var list = await UserRepository.GetListAsync(input.Sorting, input.MaxResultCount, input.SkipCount, input.Filter); var list = await UserRepository.GetListAsync(input.Sorting, input.MaxResultCount, input.SkipCount, input.Filter);

2
modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityRoleRepository.cs

@ -41,7 +41,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore
.WhereIf(!filter.IsNullOrWhiteSpace(), .WhereIf(!filter.IsNullOrWhiteSpace(),
x => x.Name.Contains(filter) || x => x.Name.Contains(filter) ||
x.NormalizedName.Contains(filter)) x.NormalizedName.Contains(filter))
.OrderBy(sorting ?? nameof(IdentityRole.Name)) .OrderBy(sorting.IsNullOrWhiteSpace() ? nameof(IdentityRole.Name) : sorting)
.PageBy(skipCount, maxResultCount) .PageBy(skipCount, maxResultCount)
.ToListAsync(GetCancellationToken(cancellationToken)); .ToListAsync(GetCancellationToken(cancellationToken));
} }

2
modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityUserRepository.cs

@ -149,7 +149,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore
(u.Surname != null && u.Surname.Contains(filter)) || (u.Surname != null && u.Surname.Contains(filter)) ||
(u.PhoneNumber != null && u.PhoneNumber.Contains(filter)) (u.PhoneNumber != null && u.PhoneNumber.Contains(filter))
) )
.OrderBy(sorting ?? nameof(IdentityUser.UserName)) .OrderBy(sorting.IsNullOrWhiteSpace() ? nameof(IdentityUser.UserName) : sorting)
.PageBy(skipCount, maxResultCount) .PageBy(skipCount, maxResultCount)
.ToListAsync(GetCancellationToken(cancellationToken)); .ToListAsync(GetCancellationToken(cancellationToken));
} }

Loading…
Cancel
Save