This commit is contained in:
2020-11-18 14:51:50 +00:00
parent 4a3e7dbcb3
commit aee2bbcdfa
4 changed files with 29 additions and 18 deletions

View File

@@ -348,9 +348,7 @@ namespace AyaNova.Biz
await ValidateCanDelete(dbObject);
if (HasErrors)
return false;
//Remove the object
ct.User.Remove(dbObject);
await ct.SaveChangesAsync();
//Delete sibling objects
//USEROPTIONS
await ct.Database.ExecuteSqlInterpolatedAsync($"delete from auseroptions where userid = {dbObject.Id}");
@@ -365,6 +363,11 @@ namespace AyaNova.Biz
await Search.ProcessDeletedObjectKeywordsAsync(dbObject.Id, BizType, ct);
await TagBiz.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags);
await FileUtil.DeleteAttachmentsForObjectAsync(BizType, dbObject.Id, ct);
//Remove the object
ct.User.Remove(dbObject);
await ct.SaveChangesAsync();
await transaction.CommitAsync();
await NotifyEventProcessor.HandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject);
}