public ActionResult CreateContainer() { var vm = new CreateContainerViewModel() { Name = defaultContainerName }; return(View(vm)); }
public ActionResult CreateContainer(CreateContainerViewModel vm) { CloudStorageAccount storageAccount = GetStorageAccount(); CloudBlobClient blobClient = GetBlobClient(storageAccount); CloudBlobContainer container = GetContainer(blobClient, vm.Name); // Create the container if it doesn't already exist. container.CreateIfNotExists(); // Set the container as public. container.SetPermissions( new BlobContainerPermissions { PublicAccess = BlobContainerPublicAccessType.Blob }); return(RedirectToAction("Index")); }