public void RegisterAccount(Account account) { var accountIndex = _accountIndexRepository.FindByAccountName(account.Name); if (accountIndex == null) { _accountIndexRepository.Add(new AccountIndex(account.Id, account.Name)); } else if (accountIndex.AccountId != account.Id) { throw new DuplicateAccountException(account.Name); } }
/// <summary>注册账号索引 /// </summary> /// <param name="indexId"></param> /// <param name="accountId"></param> /// <param name="accountName"></param> /// <returns></returns> public void RegisterAccountIndex(string indexId, string accountId, string accountName) { var accountIndex = _accountIndexRepository.FindByAccountName(accountName); if (accountIndex == null) { _accountIndexRepository.Add(new AccountIndex(indexId, accountId, accountName)); } else if (accountIndex.IndexId != indexId) { throw new DuplicateAccountException(accountName); } }