public IViewComponentResult Invoke(int userId) { int workspaceId = Convert.ToInt32(HttpContext.Session.GetString("WorkspaceId")); HomeModel model = new HomeModel(); model.Workspaces = _workspaceService.GetAll(userId); model.Workspace = _workspaceService.Get(workspaceId); return(View(model)); }
public override void CalculateSteps() { base.CalculateSteps(); if (workspaceService.Exists(diskPath)) { zipFileSystem = workspaceService.Get(diskPath).Value as ZipFileSystem; if (zipFileSystem == null || zipFileSystem.PhysicalRoot == null) { return; } // Get the physical path physicalPath = zipFileSystem.PhysicalRoot; physicalBackupPath = zipFileSystem.PhysicalRoot + ".bak"; steps.Add(BackupZip); // Get all the files var srcFiles = zipFileSystem.GetEntitiesRecursive(WorkspacePath.Root).ToArray(); // Convert files into the correct format: src/dest path var files = new Dictionary <WorkspacePath, WorkspacePath>(); foreach (var file in srcFiles) { files.Add(diskPath.AppendPath(file), file); } // Create the zip exporter zipExporter = new ZipExporter(diskPath.Path, FileLoadHelper, files); // Calculate all the zip steps zipExporter.CalculateSteps(); for (int i = 0; i < zipExporter.totalSteps; i++) { steps.Add(NextZipStep); } // Save the disk steps.Add(SaveDisk); steps.Add(CheckForErrors); steps.Add(Cleanup); } }
public IViewComponentResult Invoke(int userId) { HomeModel model = new HomeModel(); int workspaceId = Convert.ToInt32(HttpContext.Session.GetString("WorkspaceId")); if (workspaceId != 0) { model.Categories = _workspaceService.GetAllCategory(workspaceId, userId); model.Notes = _workspaceService.GetAllNote(model.Categories); model.Workspace = _workspaceService.Get(workspaceId); return(View(model)); } else { return(View(model)); } }