示例#1
0
        private void ValidateAgainstExistingAccounts(User user, Interfaces.Model.AccountType originalAccountType, AccountType mappedAccountType,
                                                     string accountName)
        {
            if (repository.AccountExists(mappedAccountType, accountName))
            {
                throw new UserAccountAlreadyAssignedException(accountName);
            }

            if (user.HasAccountType(mappedAccountType))
            {
                throw new UserAccountTypeAlreadyAssignedException(originalAccountType);
            }
        }
示例#2
0
 private void ThrowIfAccountNameIsAlreadyAssigned(AccountType type, string name, string newName)
 {
     if (!name.Equals(newName, StringComparison.InvariantCultureIgnoreCase) && repository.AccountExists(type, newName))
     {
         throw new UserAccountAlreadyAssignedException(newName);
     }
 }