This commit is contained in:
2020-11-18 17:56:24 +00:00
parent 01198a427b
commit 95f16c4f3f

View File

@@ -190,6 +190,8 @@ namespace AyaNova.Biz
newObject.Salt = Hasher.GenerateSalt(); newObject.Salt = Hasher.GenerateSalt();
newObject.Password = Hasher.GenerateSalt(); newObject.Password = Hasher.GenerateSalt();
newObject.Login = Hasher.GenerateSalt(); newObject.Login = Hasher.GenerateSalt();
newObject.UserOptions = new UserOptions();
newObject.UserOptions.TranslationId = ServerBootConfig.AYANOVA_DEFAULT_TRANSLATION_ID;
await ct.User.AddAsync(newObject); await ct.User.AddAsync(newObject);
await ct.SaveChangesAsync(); await ct.SaveChangesAsync();
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct); await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
@@ -345,7 +347,7 @@ namespace AyaNova.Biz
await ValidateCanDelete(dbObject); await ValidateCanDelete(dbObject);
if (HasErrors) if (HasErrors)
return false; return false;
//Delete sibling objects //Delete sibling objects
//USEROPTIONS //USEROPTIONS
await ct.Database.ExecuteSqlInterpolatedAsync($"delete from auseroptions where userid = {dbObject.Id}"); await ct.Database.ExecuteSqlInterpolatedAsync($"delete from auseroptions where userid = {dbObject.Id}");
@@ -364,7 +366,7 @@ namespace AyaNova.Biz
//Remove the object //Remove the object
ct.User.Remove(dbObject); ct.User.Remove(dbObject);
await ct.SaveChangesAsync(); await ct.SaveChangesAsync();
await transaction.CommitAsync(); await transaction.CommitAsync();
await NotifyEventProcessor.HandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject); await NotifyEventProcessor.HandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject);
} }