コード例 #1
0
        public async Task <IActionResult> Details(int?id, int?docId, int?pageId)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var parentFolder = await _unitOfWork.Documents.GetFolderByIdAsync(Convert.ToInt32(id));

            var folderItems = new FolderItemsViewModel();
            var crumbs      = new Dictionary <int?, string>();

            folderItems.Folders = docId == null ? await _unitOfWork.Documents.GetFoldersByParentId(id) : new List <DocumentFolder>();

            folderItems.Documents = await _unitOfWork.Documents.GetDocumentsByParentId(id, docId);

            folderItems.PageId       = pageId;
            folderItems.ParentFolder = parentFolder;

            var pathCrumbs = await GetCrumbs(id);

            folderItems.PathCrumbs = pathCrumbs.OrderByDescending(c => c.Sort);
            if (folderItems == null)
            {
                return(NotFound());
            }

            return(View(folderItems));
        }
コード例 #2
0
        public IViewComponentResult Invoke(FolderItemsViewModel folderItems)
        {
            //int pageSize = 2;
            //var pagedFolders = await PaginatedList<DocumentFolder>
            //                .CreateAsync(folderItems.Folders.ToList().Union(folderItems.Documents.ToList()).ToList(), folderItems.PageId ?? 1, pageSize);

            //folderItems.Folders = pagedFolders;

            return(View("AdminDirectory", folderItems));
        }
コード例 #3
0
        public async Task <IActionResult> Index(int?folderId, int?docId)
        {
            var folders = await _unitOfWork.Documents.GetDocumentFolders();

            var folderItems = new FolderItemsViewModel();

            folderItems.Folders        = folders;
            folderItems.Documents      = Enumerable.Empty <Document>();
            folderItems.ParentFolder   = null;
            folderItems.SearchFolderId = folderId != null && folderId > 0 ? folderId : 0;
            folderItems.SearchDocId    = docId;
            // folderItems.PageId = pageId;

            return(View(folderItems));
        }