PARR.EsppTemplateSyncWorker

This commit is contained in:
Mikhail Trubnikov
2023-08-25 15:32:06 +10:00
parent 17feefce02
commit e284b3ca19
17 changed files with 363 additions and 9 deletions

View File

@@ -99,5 +99,26 @@ namespace PARR.BLL.Services.Implementations
//return false;
}
}
public bool DeleteFile(string path)
{
logger.LogInformation($"Удаляю файл: {path}");
try
{
if (!File.Exists(path))
return true;
File.Delete(path);
logger.LogInformation($"Файл удален: {path}");
return true;
}
catch (Exception e)
{
logger.LogError(e, $"Ошибка при удалении файла {path}");
return false;
}
}
}
}

View File

@@ -22,5 +22,12 @@ namespace PARR.BLL.Services.Interfaces
/// <param name="allowedExtensions"></param>
/// <returns></returns>
bool IsExtensionAllowed(IFormFile formFile, string[] allowedExtensions);
/// <summary>
/// Удалить файл
/// </summary>
/// <param name="path">Полный путь к файлу</param>
/// <returns></returns>
bool DeleteFile(string path);
}
}