Skip to content
Snippets Groups Projects
Commit c0fb1b27 authored by esantangelo's avatar esantangelo
Browse files

get file names

parent b80f6a9a
No related branches found
No related tags found
2 merge requests!26Develop,!21course sections
Pipeline #10294 passed
...@@ -11,6 +11,7 @@ namespace Tsi1.BusinessLayer.Interfaces ...@@ -11,6 +11,7 @@ namespace Tsi1.BusinessLayer.Interfaces
public interface IFileService public interface IFileService
{ {
Task<ServiceResult<string>> Create(IFormFile file, string tenantId, string courseId); Task<ServiceResult<string>> Create(IFormFile file, string tenantId, string courseId);
Task<List<string>> GetFileNames();
ServiceResult<bool> DeleteFile(string filePath); ServiceResult<bool> DeleteFile(string filePath);
bool ExistFile(string relativePath); bool ExistFile(string relativePath);
} }
......
...@@ -115,5 +115,14 @@ namespace Tsi1.BusinessLayer.Services ...@@ -115,5 +115,14 @@ namespace Tsi1.BusinessLayer.Services
return fileName + "." + ext; return fileName + "." + ext;
} }
public async Task<List<string>> GetFileNames()
{
var fileNames = await _context.Files.Select(x => Path.GetFileName(x.Path)).ToListAsync();
fileNames.RemoveAll(x => x.Length == 0);
return fileNames;
}
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment