no delete option.

This commit is contained in:
DESKTOP-T0O5CDB\DESK-555BD
2024-01-17 12:33:31 -07:00
parent cf11c203ce
commit c77f9bce51

View File

@@ -60,20 +60,30 @@ namespace CarCareTracker.Helper
if (Directory.Exists(imagePath))
{
var existingPath = Path.Combine(_webEnv.WebRootPath, "images");
if (Directory.Exists(existingPath))
if (!Directory.Exists(existingPath))
{
Directory.Delete(existingPath, true);
Directory.CreateDirectory(existingPath);
}
//copy each files from temp folder to newPath
var filesToUpload = Directory.GetFiles(imagePath);
foreach(string file in filesToUpload)
{
File.Copy(file, $"{existingPath}/{Path.GetFileName(file)}");
}
Directory.Move(imagePath, existingPath);
}
if (Directory.Exists(documentPath))
{
var existingPath = Path.Combine(_webEnv.WebRootPath, "documents");
if (Directory.Exists(existingPath))
if (!Directory.Exists(existingPath))
{
Directory.Delete(existingPath, true);
Directory.CreateDirectory(existingPath);
}
//copy each files from temp folder to newPath
var filesToUpload = Directory.GetFiles(documentPath);
foreach (string file in filesToUpload)
{
File.Copy(file, $"{existingPath}/{Path.GetFileName(file)}");
}
Directory.Move(documentPath, existingPath);
}
if (File.Exists(dataPath))
{