public ActionResult ManageUploads([DefaultValue(1)] int page) { var basePath = _pathMapper.MapPath(UploadsBasePath); var fileInfoList = new List<FileEntry>(); var files = Directory.GetFiles(basePath).ToList(); files.ForEach(file => fileInfoList.Add(GetFileEntry(file))); var fileInfoListSorted = fileInfoList.OrderBy(f => f.FileName).ToList(); var model = new AdminUploadsViewModel { FileEntries = fileInfoListSorted.Skip((page - 1) * _itemsPerPage).Take(_itemsPerPage).ToList(), PagingInfo = new PagingInformation { CurrentPage = page, ItemsPerPage = _itemsPerPage, TotalItems = fileInfoList.Count }, OneTimeCode = GetToken(), Title = SettingsRepository.BlogName }; return View(model); }
public ActionResult SelectFile(string CKEditorFuncNum) { var basePath = _pathMapper.MapPath(UploadsBasePath); var fileInfoList = new List<FileEntry>(); var files = Directory.GetFiles(basePath); files.ToList().ForEach(file => fileInfoList.Add(new FileEntry { FileName = Path.GetFileName(file), FileIconName = GetFileInfoByExt(Path.GetExtension(file)) })); var model = new AdminUploadsViewModel { FileEntries = fileInfoList.OrderBy(f => f.FileName).ToList(), CKEditorFuncNum = CKEditorFuncNum }; return View(model); }