public static IQueryable<Apprenticeship> WithProviderOrEmployerId( this IQueryable<Apprenticeship> apprenticeships, IEmployerProviderIdentifier identifier) { if (identifier.ProviderId.HasValue) { return apprenticeships.Where(app => app.Cohort.ProviderId == identifier.ProviderId); } return identifier.EmployerAccountId.HasValue ? apprenticeships.Where(app => app.Cohort.EmployerAccountId == identifier.EmployerAccountId) : apprenticeships; }
public static IQueryable<Apprenticeship> WithAlerts( this IQueryable<Apprenticeship> apprenticeships, bool hasAlerts, IEmployerProviderIdentifier identifier) { return identifier.ProviderId.HasValue ? WithAlertsProvider(apprenticeships, hasAlerts) : WithAlertsEmployer(apprenticeships, hasAlerts); }