コード例 #1
0
        private async Task <IEnumerable <ImageViewModel> > MapListing(Listing listing, Dictionary <object, object> state)
        {
            if (listing.Data.After != null)
            {
                state["After"] = listing.Data.After;
            }

            var mappedImages = listing.Data.Children
                               .Where(thing => thing.Data is Link)
                               .Select(async(thing) => MapImage(await _imagesService.GetImagesFromUrl(((Link)thing.Data).Title, ((Link)thing.Data).Url)));

            var result = new List <ImageViewModel>();

            foreach (var mappedImage in mappedImages)
            {
                result.AddRange(await mappedImage);
            }
            return(result);
        }