public async Task <IDictionary <string, StarWarsCharacter> > FetchCharacterByIdAsync(IEnumerable <string> ids) { var characters = await Task.WhenAll(ids.Select(id => _service.FetchCharacterByIdAsync <StarWarsCharacter>(id))); return(characters.ToDictionary(x => x.Id)); }
public Task <Droid> Hero() { return(_service.FetchCharacterByIdAsync <Droid>("3")); }
public Task <StarWarsCharacter[]> Friends(Human source) { var friends = source.Friends ?? new string[0]; return(Task.WhenAll(friends.Select(id => _service.FetchCharacterByIdAsync <StarWarsCharacter>(id)))); }