fixed deletion
This commit is contained in:
parent
fd52a94d18
commit
50e01e6c8c
|
@ -76,7 +76,7 @@ public static class InstallationMethods
|
|||
var deletedInstallation = new DeletedInstallation();
|
||||
foreach (var property in installation.GetType().GetProperties())
|
||||
{
|
||||
property.SetValue(deletedInstallation ,property.GetValue(installation));
|
||||
property.SetValue(deletedInstallation, property.GetValue(installation));
|
||||
}
|
||||
|
||||
return deletedInstallation;
|
||||
|
|
|
@ -23,37 +23,42 @@ public static partial class Db
|
|||
{
|
||||
FolderAccess .Delete(r => r.FolderId == f.Id);
|
||||
Installations.Delete(r => r.ParentId == f.Id);
|
||||
var delete = Folders.Delete(r => r.Id == f.Id);
|
||||
BackupDatabase();
|
||||
return delete > 0;
|
||||
var delete = Folders.Delete(r => r.Id == f.Id);
|
||||
var deleteSuccess = delete > 0;
|
||||
if (deleteSuccess)
|
||||
BackupDatabase();
|
||||
return deleteSuccess;
|
||||
}
|
||||
}
|
||||
|
||||
public static Boolean Delete(Installation installation)
|
||||
{
|
||||
return RunTransaction(DeleteInstallationAndItsDependencies);
|
||||
|
||||
var deleteSuccess = RunTransaction(DeleteInstallationAndItsDependencies);
|
||||
if (deleteSuccess)
|
||||
BackupDatabase();
|
||||
return deleteSuccess;
|
||||
|
||||
|
||||
Boolean DeleteInstallationAndItsDependencies()
|
||||
{
|
||||
InstallationAccess.Delete(i => i.InstallationId == installation.Id);
|
||||
var delete = Installations.Delete(i => i.Id == installation.Id);
|
||||
BackupDatabase();
|
||||
return delete > 0;
|
||||
return Installations.Delete(i => i.Id == installation.Id) > 0;
|
||||
}
|
||||
}
|
||||
|
||||
public static Boolean Delete(User user)
|
||||
{
|
||||
return RunTransaction(DeleteUserAndHisDependencies);
|
||||
var deleteSuccess = RunTransaction(DeleteUserAndHisDependencies);
|
||||
if (deleteSuccess)
|
||||
BackupDatabase();
|
||||
return deleteSuccess;
|
||||
|
||||
Boolean DeleteUserAndHisDependencies()
|
||||
{
|
||||
FolderAccess .Delete(u => u.UserId == user.Id);
|
||||
InstallationAccess.Delete(u => u.UserId == user.Id);
|
||||
|
||||
var delete = Users.Delete(u => u.Id == user.Id);
|
||||
BackupDatabase();
|
||||
return delete > 0;
|
||||
return Users.Delete(u => u.Id == user.Id) > 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -64,7 +69,8 @@ public static partial class Db
|
|||
private static Boolean Delete(Session session)
|
||||
{
|
||||
var delete = Sessions.Delete(s => s.Id == session.Id) > 0;
|
||||
BackupDatabase();
|
||||
if (delete)
|
||||
BackupDatabase();
|
||||
return delete;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue