Пример #1
0
        public async Task <IActionResult> Index(string cursor = null)
        {
            BlobServiceClient blobServiceClient = new BlobServiceClient(containerConnectionString);
            var blobContainerClient             = blobServiceClient.GetBlobContainerClient(Constants.ContainerName);
            var blobList = blobContainerClient.GetBlobs().ToList();

            var model           = new FileUploaderModel();
            var changeEventTask = changeFeedReader.ReadChangeFeedAsync(cursor);

            blobList.ForEach(async blob =>
            {
                var blobItem      = new Blob();
                blobItem.BlobItem = blob;
                blobItem.Metadata = await metadataReader.ReadMetadata(blobContainerClient, blob.Name);
                model.Blobs.Add(blobItem);
            });

            var keyFeedEvents = await changeEventTask;
            var key           = keyFeedEvents.Keys.FirstOrDefault();

            cursor       = key;
            model.Cursor = key;
            if (key != null)
            {
                model.BlobChangeEventFeeds = keyFeedEvents[key].OrderByDescending(o => o.EventTime).ToList();
            }
            else
            {
                model.BlobChangeEventFeeds = new List <Azure.Storage.Blobs.ChangeFeed.BlobChangeFeedEvent>();
            }

            return(View(model));
        }