コード例 #1
0
 public BlobModel GetFile(Guid key)
 {
     var blobMetaData = Table.GetMetaData(key);
     var blobFileModel =
         new BlobModel
             {
                 UploadedOn = blobMetaData.Date,
                 BlobFile = Blob.GetBlob(blobMetaData.ResourceUri),
                 ResourceLocation = blobMetaData.ResourceUri
             };
     return blobFileModel;
 }
コード例 #2
0
        public void PutFile(BlobModel blobModel)
        {
            var blobFileName = string.Format("{0}-{1}", DateTime.Now.ToString("yyyyMMdd"), blobModel.ResourceLocation);
            var blobUri = Blob.PutBlob(blobModel.BlobFile, blobFileName);

            Table.Add(
                new BlobMeta
                    {
                        Date = DateTime.Now,
                        ResourceUri = blobUri,
                        RowKey = Guid.NewGuid().ToString()
                    });

            Queue.Add(new CloudQueueMessage(blobUri + "$" + blobFileName));
        }
コード例 #3
0
        public ActionResult UploadFile()
        {
            foreach (string inputTagName in Request.Files)
            {
            var file = Request.Files[inputTagName];

            if (file.ContentLength > 0)
            {
                var blobFileModel =
                    new BlobModel
                        {
                            BlobFile = file.InputStream,
                            UploadedOn = DateTime.Now,
                            ResourceLocation = Path.GetFileName(file.FileName)
                        };

                var fileBlobManager = new FileBlobManager();
                fileBlobManager.PutFile(blobFileModel);
            }
            }

            return RedirectToAction("Index", "Home");
        }
コード例 #4
0
 public void InstantiateBlobFileModel()
 {
     var blobFileModel = new BlobModel();
     Assert.IsNotNull(blobFileModel);
 }