public ActionResult GetAllVersions(string fileName, string uniqueFileName) { ViewBag.FileName = fileName; var versionList = VersionBlob.GetVersionInfo(DomainContext, new StreamBlob { Name = uniqueFileName, Path = "sagelabs" }); var model = new VersionModel(versionList, fileName, uniqueFileName); ViewBag.IsUploaded = true; ViewBag.HasUploadError = false; ViewBag.VersionListed = true; ViewBag.UniqueFileName = uniqueFileName; return View("VersionIndex", model); }
public ActionResult DeleteVersion(string fileName, string uniqueFileName, int versionNumber) { ViewBag.FileName = fileName; ViewBag.UniqueFileName = uniqueFileName; ViewBag.IsUploaded = true; ViewBag.HasUploadError = false; ViewBag.VersionListed = true; var list = VersionBlob.GetVersionInfo(DomainContext, new StreamBlob { Name = uniqueFileName, Path = "sagelabs" }); var model = new VersionModel(list, fileName, uniqueFileName); var snapshot = model.VersionInfos.SingleOrDefault(x => x.VersionNumber == versionNumber).SnapshotDateTime; VersionBlob.Delete(DomainContext, new VersionBlobData<Stream> { BaseBlobData = new StreamBlob { Content = Response.OutputStream, Name = uniqueFileName, Path = "sagelabs" }, SnapshotDateTime = snapshot }); list = VersionBlob.GetVersionInfo(DomainContext, new StreamBlob { Name = uniqueFileName, Path = "sagelabs" }); model = new VersionModel(list, fileName, uniqueFileName); return View("VersionIndex", model); }
public ActionResult DownloadVersion(string fileName, string uniqueFileName, int versionNumber) { ViewBag.FileName = fileName; ViewBag.UniqueFileName = uniqueFileName; ViewBag.IsUploaded = true; ControllerContext.HttpContext.Response.CacheControl = "private"; ControllerContext.HttpContext.Response.AppendHeader("content-disposition", "attachment; filename=\"" + fileName + "\""); ControllerContext.HttpContext.Response.ContentType = "application/force-download"; ControllerContext.HttpContext.Response.BufferOutput = false; Stream ret = new MemoryStream(); var versionList = VersionBlob.GetVersionInfo(DomainContext, new StreamBlob { Name = uniqueFileName, Path = "sagelabs" }); var model = new VersionModel(versionList, fileName, uniqueFileName); var snapshot = model.VersionInfos.SingleOrDefault(x => x.VersionNumber == versionNumber).SnapshotDateTime; VersionBlob.Get(DomainContext, new VersionBlobData<Stream> { BaseBlobData = new StreamBlob { Content = Response.OutputStream, Name = uniqueFileName, Path = "sagelabs" }, SnapshotDateTime = snapshot }); ret.Position = 0; ret.CopyTo(Response.OutputStream); Response.Flush(); return null; }