Пример #1
0
        public async Task <IEnumerable <string> > GetRandomImage()
        {
            var searchResponse = await _searchClient.SearchImagesAsync("goat");

            var resultImages      = searchResponse.GoatImages.ToList();
            var randomResultIndex = new Random().Next(resultImages.Count);
            var randomImage       = new[] { "url", resultImages[randomResultIndex].ThumbnailUrl };

            return(randomImage);
        }