/// <summary> /// Delete attribute of base item before base item is deleted /// </summary> /// <param name="item">Base item about to be deleted</param> public void OnItemDelete(Item item) { if (item.HasData <AccountData>()) { var data = item.GetData <AccountData>(); AccountDataRepo.Delete(data); } }
/// <summary> /// Delete an account and all associated account characters /// </summary> /// <param name="accountId"></param> public void Delete(Guid accountId) { var accountCharacterDatas = ModuleManager.GetManager <IAccountCharacterManager>() .ReadByAccount(accountId); var accountCharacterItemIds = accountCharacterDatas.Select(x => x.CharacterItemId).ToList(); if (accountCharacterItemIds.Count > 0) { ModuleManager.GetManager <IAccountCharacterManager>().Delete(accountCharacterItemIds); } var accountData = AccountDataRepo.Read(accountId); AccountDataRepo.Delete(accountData); }