public IActionResult Uploads() { IDirectoryContents contents = _fileProvider.GetDirectoryContents("wwwroot/uploads"); IOrderedEnumerable <IFileInfo> lastModified = contents.ToList() .OrderByDescending(f => f.LastModified); return(View(lastModified)); }
private List <UploadFile> ExtractFiles() { var uploadedFiles = new List <UploadFile>(); _files.ToList().ForEach(x => uploadedFiles.Add(new UploadFile { ClientId = _clientSettings.Value.ClientId, DateUpload = x.LastModified.DateTime, FileName = x.Name, ShortName = GetDateParts(x.Name).Item1, FileDate = GetDateParts(x.Name).Item2 })); return(uploadedFiles); }
public IActionResult GetAll([FromQuery] GetAllSvgsRequest input) { IDirectoryContents contents = _fileProvider.GetDirectoryContents("wwwroot/svg"); var lastModified = contents.ToList() .Where(f => !f.IsDirectory) .OrderByDescending(f => f.LastModified) .ToList(); return(Ok(new GetAllSvgsResponse { Files = lastModified .Select(f => new GetAllSvgsResponse.File { Name = f.Name, Size = f.Length }) .ToList() })); }