refactor user deletion

This commit is contained in:
Shaun Walker
2021-03-29 12:58:40 -04:00
parent 7223952eb2
commit d8bcc32239
7 changed files with 50 additions and 29 deletions

View File

@ -90,15 +90,7 @@ namespace Oqtane.Repository
_db.Folder.Remove(folder);
_db.SaveChanges();
}
public void DeleteUserFolder(int userId)
{
string userFolderPath = Utilities.PathCombine("Users", userId.ToString(), System.IO.Path.DirectorySeparatorChar.ToString());
List<int> folderIdsToDelete = new List<int>(_db.Folder.Where(a => a.Path == userFolderPath).Select(a => a.FolderId));
foreach (int folderId in folderIdsToDelete)
{
DeleteFolder(folderId);
}
}
public string GetFolderPath(int folderId)
{
Folder folder = _db.Folder.Find(folderId);