Exemple #1
0
        public async Task <FolderModel> GetFolder(IEnumerable <string> path, CancellationToken cancellationToken)
        {
            var currentFolder = await foldersService.GetRootFolder(cancellationToken);

            foreach (var currentSubfolderName in path)
            {
                var currentSubfolder = currentFolder.Subfolders.SingleOrDefault(sf => String.Equals(sf.Name, currentSubfolderName, StringComparison.Ordinal));
                if (currentSubfolder == null)
                {
                    // The requested folder (or some of its parents) does not exist.
                    return(null);
                }

                currentFolder = currentSubfolder;
            }

            return(currentFolder);
        }
        // GET: Folders
        public async Task <ActionResult> Index()
        {
            var rootFolder = await _foldersService.GetRootFolder();

            return(View(rootFolder));
        }
        private async Task LoadRootFolder(CancellationToken cancellationToken)
        {
            var rootFolderData = await foldersService.GetRootFolder(cancellationToken);

            LoadFolder(rootFolderData);
        }