protected override async Task <IEnumerable <IContact> > GetDataAsync(IGetContactWithBirthdayCollectionQuery query, IRefreshableToken token) { NullGuard.NotNull(query, nameof(query)) .NotNull(token, nameof(token)); int birthdayWithinDays = query.BirthdayWithinDays; IEnumerable <IContact> contacts = await MicrosoftGraphRepository.GetContactsAsync(token); if (contacts == null) { return(new List <IContact>(0)); } IEnumerable <IContact> appliedSupplementContacts = await ContactRepository.ApplyContactSupplementAsync(contacts); if (appliedSupplementContacts == null) { return(new List <IContact>(0)); } return(appliedSupplementContacts .Where(contact => contact.HasBirthdayWithinDays(birthdayWithinDays)) .ToList()); }
protected override async Task <IEnumerable <IContact> > GetDataAsync(IGetContactCollectionQuery query, IRefreshableToken token) { NullGuard.NotNull(query, nameof(query)) .NotNull(token, nameof(token)); IEnumerable <IContact> contacts = await MicrosoftGraphRepository.GetContactsAsync(token); if (contacts == null) { return(new List <IContact>(0)); } return(await ContactRepository.ApplyContactSupplementAsync(contacts)); }
protected override async Task <IContact> GetDataAsync(IGetContactQuery query, IRefreshableToken token) { NullGuard.NotNull(query, nameof(query)) .NotNull(token, nameof(token)); IContact contact = await MicrosoftGraphRepository.GetContactAsync(token, query.ExternalIdentifier); if (contact == null) { return(null); } return(await ContactRepository.ApplyContactSupplementAsync(contact)); }
protected override async Task <IEnumerable <IContact> > GetDataAsync(IGetMatchingContactCollectionQuery query, IRefreshableToken token) { NullGuard.NotNull(query, nameof(query)) .NotNull(token, nameof(token)); string searchFor = query.SearchFor; SearchOptions searchOptions = query.SearchOptions; IEnumerable <IContact> contacts = await MicrosoftGraphRepository.GetContactsAsync(token); if (contacts == null) { return(new List <IContact>(0)); } IEnumerable <IContact> matchingContacts = contacts .Where(contact => contact.IsMatch(searchFor, searchOptions)) .ToArray(); return(await ContactRepository.ApplyContactSupplementAsync(matchingContacts)); }