Skip to content

Commit 98b0867

Browse files
author
agile.zhou
committed
Fixbug: can not search app when sort direction is null
1 parent 3177b04 commit 98b0867

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/AgileConfig.Server.Service/AppService.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ public Task<List<App>> GetAllAppsAsync()
159159
}
160160

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

165165
return (apps, count);
@@ -230,7 +230,7 @@ public Task<List<App>> GetAllAppsAsync()
230230

231231
if (sortProperty.TryGetValue(sortField, out var propertyInfo))
232232
{
233-
appGroupList = ascOrDesc.StartsWith("asc")
233+
appGroupList = ascOrDesc?.StartsWith("asc") ?? true
234234
? appGroupList.OrderBy(x => propertyInfo.GetValue(x.App, null)).ToList()
235235
: appGroupList.OrderByDescending(x => propertyInfo.GetValue(x.App, null)).ToList();
236236
}

0 commit comments

Comments
 (0)