Skip to content

Commit

Permalink
fix: Children not ordered alphabetically
Browse files Browse the repository at this point in the history
Due to wrong ordering of select statements the ordering was dropped.
  • Loading branch information
LuukvH committed Jun 26, 2024
1 parent 13dbc91 commit 1a8e485
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@ public async Task<IReadOnlyList<Child>> PagedAsync(IPaginationFilter paginationF
int skip = (paginationFilter.PageNumber - 1) * paginationFilter.PageSize;

IQueryable<Child> children = _dbContext.Set<Child>().AsQueryable();

if (!String.IsNullOrEmpty(search))
{
children = children.Where(child => (child.GivenName + child.FamilyName).Contains(search, StringComparison.OrdinalIgnoreCase));
}

children = children.Skip((paginationFilter.PageNumber - 1) * paginationFilter.PageSize).Take(paginationFilter.PageSize);
children = children.OrderBy(child => child.GivenName).ThenBy(child => child.FamilyName);
children = children.Skip((paginationFilter.PageNumber - 1) * paginationFilter.PageSize).Take(paginationFilter.PageSize);

return await children.ToListAsync();
}
Expand Down

0 comments on commit 1a8e485

Please sign in to comment.