-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #245 from SkillsFundingAgency/CON-3949---Add-searc…
…h-+-sorting-to-Choose-an-Employer-page-in-Reserve-funding-journey CON-3949 Add search + sorting to Choose an Employer page in Reserve funding journey
- Loading branch information
Showing
14 changed files
with
453 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
src/SFA.DAS.Reservations.Web/Extensions/AccountLegalEntityExtension.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using SFA.DAS.Reservations.Domain.Employers; | ||
using SFA.DAS.Reservations.Web.Models; | ||
|
||
namespace SFA.DAS.Reservations.Web.Extensions | ||
{ | ||
public static class AccountLegalEntityExtension | ||
{ | ||
public static List<AccountLegalEntity> Order(this List<AccountLegalEntity> accountLegalEntities, SortModel sortModel) | ||
{ | ||
if (string.IsNullOrWhiteSpace(sortModel.SortField)) return accountLegalEntities; | ||
|
||
if (sortModel.SortField == nameof(AccountLegalEntity.AccountLegalEntityName)) | ||
{ | ||
accountLegalEntities = (sortModel.ReverseSort | ||
? accountLegalEntities.OrderByDescending(ale => ale.AccountLegalEntityName) | ||
.ThenBy(ale => ale.AccountName) | ||
.ThenBy(ale => ale.AccountLegalEntityPublicHashedId) | ||
: accountLegalEntities.OrderBy(ale => ale.AccountLegalEntityName) | ||
.ThenBy(ale => ale.AccountName) | ||
.ThenBy(ale => ale.AccountLegalEntityPublicHashedId)).ToList(); | ||
} | ||
else | ||
{ | ||
accountLegalEntities = (sortModel.ReverseSort | ||
? accountLegalEntities.OrderByDescending(ale => ale.AccountName) | ||
.ThenBy(ale => ale.AccountLegalEntityName) | ||
.ThenBy(ale => ale.AccountLegalEntityPublicHashedId) | ||
: accountLegalEntities.OrderBy(ale => ale.AccountName) | ||
.ThenBy(ale => ale.AccountLegalEntityName) | ||
.ThenBy(ale => ale.AccountLegalEntityPublicHashedId)).ToList(); | ||
} | ||
|
||
return accountLegalEntities; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.