public IList <UniqueLearnerNumber> GetUlnLookup(IList <long?> searchUlns, CancellationToken cancellationToken) { var uniqueUlns = searchUlns.Distinct(); var unknownUlns = uniqueUlns.Where(uln => Ulns.All(u => u.ULN != uln)).ToList(); if (unknownUlns.Any()) { Ulns.AddRange(_referenceDataRepository.GetUlnLookup(unknownUlns, cancellationToken)); } return(Ulns.Where(x => searchUlns.Contains(x.ULN)).ToList()); }
public IEnumerable <long> GetUlnLookup(IEnumerable <long?> searchUlns, CancellationToken cancellationToken) { var uniqueUlns = searchUlns.Distinct().ToList(); var unknownUlns = uniqueUlns.Where(uln => Ulns.All(u => u != uln)).ToList(); if (!unknownUlns.Any()) { return(Ulns.Where(u => uniqueUlns.Contains(u))); } PopulateUlnLookup(unknownUlns, cancellationToken); return(Ulns.Where(u => unknownUlns.Contains(u))); }