fixed deletion
This commit is contained in:
parent
fd52a94d18
commit
50e01e6c8c
|
@ -24,36 +24,41 @@ public static partial class Db
|
||||||
FolderAccess .Delete(r => r.FolderId == f.Id);
|
FolderAccess .Delete(r => r.FolderId == f.Id);
|
||||||
Installations.Delete(r => r.ParentId == f.Id);
|
Installations.Delete(r => r.ParentId == f.Id);
|
||||||
var delete = Folders.Delete(r => r.Id == f.Id);
|
var delete = Folders.Delete(r => r.Id == f.Id);
|
||||||
|
var deleteSuccess = delete > 0;
|
||||||
|
if (deleteSuccess)
|
||||||
BackupDatabase();
|
BackupDatabase();
|
||||||
return delete > 0;
|
return deleteSuccess;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Boolean Delete(Installation installation)
|
public static Boolean Delete(Installation installation)
|
||||||
{
|
{
|
||||||
return RunTransaction(DeleteInstallationAndItsDependencies);
|
var deleteSuccess = RunTransaction(DeleteInstallationAndItsDependencies);
|
||||||
|
if (deleteSuccess)
|
||||||
|
BackupDatabase();
|
||||||
|
return deleteSuccess;
|
||||||
|
|
||||||
|
|
||||||
Boolean DeleteInstallationAndItsDependencies()
|
Boolean DeleteInstallationAndItsDependencies()
|
||||||
{
|
{
|
||||||
InstallationAccess.Delete(i => i.InstallationId == installation.Id);
|
InstallationAccess.Delete(i => i.InstallationId == installation.Id);
|
||||||
var delete = Installations.Delete(i => i.Id == installation.Id);
|
return Installations.Delete(i => i.Id == installation.Id) > 0;
|
||||||
BackupDatabase();
|
|
||||||
return delete > 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Boolean Delete(User user)
|
public static Boolean Delete(User user)
|
||||||
{
|
{
|
||||||
return RunTransaction(DeleteUserAndHisDependencies);
|
var deleteSuccess = RunTransaction(DeleteUserAndHisDependencies);
|
||||||
|
if (deleteSuccess)
|
||||||
|
BackupDatabase();
|
||||||
|
return deleteSuccess;
|
||||||
|
|
||||||
Boolean DeleteUserAndHisDependencies()
|
Boolean DeleteUserAndHisDependencies()
|
||||||
{
|
{
|
||||||
FolderAccess .Delete(u => u.UserId == user.Id);
|
FolderAccess .Delete(u => u.UserId == user.Id);
|
||||||
InstallationAccess.Delete(u => u.UserId == user.Id);
|
InstallationAccess.Delete(u => u.UserId == user.Id);
|
||||||
|
|
||||||
var delete = Users.Delete(u => u.Id == user.Id);
|
return Users.Delete(u => u.Id == user.Id) > 0;
|
||||||
BackupDatabase();
|
|
||||||
return delete > 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,6 +69,7 @@ public static partial class Db
|
||||||
private static Boolean Delete(Session session)
|
private static Boolean Delete(Session session)
|
||||||
{
|
{
|
||||||
var delete = Sessions.Delete(s => s.Id == session.Id) > 0;
|
var delete = Sessions.Delete(s => s.Id == session.Id) > 0;
|
||||||
|
if (delete)
|
||||||
BackupDatabase();
|
BackupDatabase();
|
||||||
return delete;
|
return delete;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue