Skip to content

Commit

Permalink
Fixbug: can not search app when sort direction is null
Browse files Browse the repository at this point in the history
  • Loading branch information
agile.zhou committed Dec 1, 2024
1 parent 3177b04 commit 98b0867
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/AgileConfig.Server.Service/AppService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public Task<List<App>> GetAllAppsAsync()
}

var apps = await _appRepository.QueryPageAsync(exp, current, pageSize, sortField,
ascOrDesc.StartsWith("asc") ? "ASC" : "DESC");
ascOrDesc?.StartsWith("asc") ?? true ? "ASC" : "DESC");
var count = await _appRepository.CountAsync(exp);

return (apps, count);
Expand Down Expand Up @@ -230,7 +230,7 @@ public Task<List<App>> GetAllAppsAsync()

if (sortProperty.TryGetValue(sortField, out var propertyInfo))
{
appGroupList = ascOrDesc.StartsWith("asc")
appGroupList = ascOrDesc?.StartsWith("asc") ?? true
? appGroupList.OrderBy(x => propertyInfo.GetValue(x.App, null)).ToList()
: appGroupList.OrderByDescending(x => propertyInfo.GetValue(x.App, null)).ToList();
}
Expand Down

0 comments on commit 98b0867

Please sign in to comment.