Esempio n. 1
0
        //public ILogger Logger { get; set; }

        public bool Create(Borrower input)
        {
            // Check validation
            if (input.FirstName == "")
            {
                throw new ArgumentNullException("First Name needs a value");
            }
            else if (input.LastName == "")
            {
                throw new ArgumentNullException("Last Name needs a value");
            }
            else if (!Helper.EmailIsValid(input.Login))
            {
                throw new ArgumentOutOfRangeException("Email not valid");
            }
            else if (CheckEmail(input.Login))
            {
                throw new ArgumentOutOfRangeException("Email already exists!  Pick Unique Email.");
            }
            else if (input.Password == "")
            {
                throw new ArgumentNullException("Password needs a value");
            }

            try
            {
                _borrowerRepository.Create(input);
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }