From 1a8e485fed66333ba359192ddc6f86a5ba2b7890 Mon Sep 17 00:00:00 2001 From: LuukvH Date: Tue, 25 Jun 2024 20:46:34 +0200 Subject: [PATCH] fix: Children not ordered alphabetically Due to wrong ordering of select statements the ordering was dropped. --- .../CRM/Infrastructure/Repositories/ChildRepository.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Services/CRM/Infrastructure/Repositories/ChildRepository.cs b/src/Services/CRM/Infrastructure/Repositories/ChildRepository.cs index 65cdc4a0..7e77453b 100644 --- a/src/Services/CRM/Infrastructure/Repositories/ChildRepository.cs +++ b/src/Services/CRM/Infrastructure/Repositories/ChildRepository.cs @@ -20,13 +20,14 @@ public async Task> PagedAsync(IPaginationFilter paginationF int skip = (paginationFilter.PageNumber - 1) * paginationFilter.PageSize; IQueryable children = _dbContext.Set().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(); }