refactor IFileService. Rename DeletedAsync method to DeleteAsync

This commit is contained in:
Фролов 2021-10-06 18:07:35 +05:00
parent 1a36609d19
commit 4cec602678
4 changed files with 6 additions and 6 deletions

View File

@ -23,7 +23,7 @@ namespace AsbCloudApp.Services
Task<int> MarkAsDeletedAsync(int idFile, Task<int> MarkAsDeletedAsync(int idFile,
CancellationToken token = default); CancellationToken token = default);
Task<IEnumerable<FileInfoDto>> GetInfosByCategoryAsync(int idWell, int idCategory, CancellationToken token = default); Task<IEnumerable<FileInfoDto>> GetInfosByCategoryAsync(int idWell, int idCategory, CancellationToken token = default);
Task<int> DeletedAsync(int id, CancellationToken token); Task<int> DeleteAsync(int id, CancellationToken token);
string GetUrl(FileInfoDto fileInfo); string GetUrl(FileInfoDto fileInfo);
string GetUrl(int idFile); string GetUrl(int idFile);
string GetUrl(int idWell, int idCategory, int idFile, string dotExtention); string GetUrl(int idWell, int idCategory, int idFile, string dotExtention);

View File

@ -43,13 +43,13 @@ namespace AsbCloudInfrastructure.Services
matchFilesIterator.MoveNext(); matchFilesIterator.MoveNext();
var matchFile = matchFilesIterator.Current; var matchFile = matchFilesIterator.Current;
while (matchFilesIterator.MoveNext()) while (matchFilesIterator.MoveNext())
await fileService.DeletedAsync(matchFilesIterator.Current.Id, token) await fileService.DeleteAsync(matchFilesIterator.Current.Id, token)
.ConfigureAwait(false); .ConfigureAwait(false);
if (filesInfos.All(f => f.UploadDate <= matchFile.UploadDate)) if (filesInfos.All(f => f.UploadDate <= matchFile.UploadDate))
return matchFile; return matchFile;
else else
await fileService.DeletedAsync(matchFile.Id, token) await fileService.DeleteAsync(matchFile.Id, token)
.ConfigureAwait(false); .ConfigureAwait(false);
} }

View File

@ -41,13 +41,13 @@ namespace AsbCloudInfrastructure.Services
matchFilesIterator.MoveNext(); matchFilesIterator.MoveNext();
var matchFile = matchFilesIterator.Current; var matchFile = matchFilesIterator.Current;
while (matchFilesIterator.MoveNext()) while (matchFilesIterator.MoveNext())
await fileService.DeletedAsync(matchFilesIterator.Current.Id, token) await fileService.DeleteAsync(matchFilesIterator.Current.Id, token)
.ConfigureAwait(false); .ConfigureAwait(false);
if (filesInfos.All(f => f.UploadDate <= matchFile.UploadDate)) if (filesInfos.All(f => f.UploadDate <= matchFile.UploadDate))
return matchFile; return matchFile;
else else
await fileService.DeletedAsync(matchFile.Id, token) await fileService.DeleteAsync(matchFile.Id, token)
.ConfigureAwait(false); .ConfigureAwait(false);
} }

View File

@ -191,7 +191,7 @@ namespace AsbCloudInfrastructure.Services
return await db.SaveChangesAsync(token).ConfigureAwait(false); return await db.SaveChangesAsync(token).ConfigureAwait(false);
} }
public async Task<int> DeletedAsync(int idFile, CancellationToken token) public async Task<int> DeleteAsync(int idFile, CancellationToken token)
{ {
var fileInfo = await db.Files var fileInfo = await db.Files
.FirstOrDefaultAsync(f => f.Id == idFile, token) .FirstOrDefaultAsync(f => f.Id == idFile, token)