Пример #1
0
        public BlobResult Get(Guid id, bool publicAccess = false)
        {
            var container = publicAccess ? _publicContainer : _container;

            var blob = container.GetBlockBlobReference(id.ToString());

            var result = new BlobResult {ContentType = blob.Properties.ContentType};

            using (var stream = new MemoryStream())
            {
                blob.DownloadToStream(stream);
                using (var reader = new BinaryReader(stream))
                {
                    stream.Position = 0;
                    result.Content = reader.ReadBytes((int)stream.Length);
                }
            }

            return result;
        }