Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • Main Employment is set

  • Order by

    • Valid From and not expired

    • Percentage

    • Has valid to

    • Valid to

    • Id

The actual implementation might clear up any remaining questions:

Code Block
languagec#
return employments
    .Where(a => a.EmploymentState.Id != (uint)CoreIdentityEmploymentStates.Deleted)
    .OrderByDescending(a => a.EmploymentState.Id)
    .ThenByDescending(a => a.MainEmployment)
    .ThenByDescending(a => a.ValidFrom <= DateTime.Now && (!a.ValidTo.HasValue || a.ValidTo.Value >= DateTime.Now.Date))
    .ThenByDescending(a => a.Percentage)
    .ThenBy(a => a.ValidFrom)
    .ThenBy(a => a.ValidTo.HasValue)
    .ThenBy(a => a.ValidTo)
    .ThenBy(a => a.Id);