Пример #1
0
        public Customer AddCustomer(string nickname, DateTime dateOfBirth)
        {
            if (!_emptyNicknameValidator.Validate(nickname))
                return null;

            if (!_duplicatedNicknameValidator.Validate(nickname, _nicknames))
                return null;
           
            var newCustomer = new Customer(nickname, dateOfBirth);
            _customers.Add(newCustomer);

            return newCustomer;
        }
Пример #2
0
        public Customer AddCustomer(string nickname, DateTime dateOfBirth, string email)
        {
            if (!_emptyNicknameValidator.Validate(nickname))
                return null;

            if (!_duplicatedNicknameValidator.Validate(nickname, _nicknames))
                return null;
           
            var newCustomer = new Customer(nickname, dateOfBirth, email, SystemTime.Today());
            //var newCustomer = new Customer(nickname, dateOfBirth, email, _systemClock.Today(), _systemClock);
            _customers.Add(newCustomer);

            _messageGateway.Send(newCustomer.Email, string.Format("Dear {0}, welcome to the bank.", newCustomer.Nickname));

            return newCustomer;
        }