PARR.EsppTemplateSyncWorker
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user