예제 #1
0
파일: Bank.cs 프로젝트: kylerader/Bank
        public Account OpenAccount(Customer customer)
        {
            if(customer==null)
            {
                throw new ArgumentNullException();
            }

            if(!CheckCredit(customer))
            {
                throw new BadCreditException();
            }

            var account = new Account(customer);
            _accounts.Add(account);
            return account;
        }
예제 #2
0
 public ActionResult Create(string firstName, string lastName, int? ficoScore)
 {
     var bank = BankRepository.GetBank();
     var auditLog = new AuditLog(bank);
     if (ficoScore == null) throw new NotSupportedException();
     var customer = new Customer(firstName, lastName, ficoScore.Value);
     var creditPassed = bank.CheckCredit(customer);
     if (creditPassed)
     {
         var newCustomer = CustomerRepository.CreateCustomer(customer);
         var account = bank.OpenAccount(newCustomer);
         var newAccount = AccountRepository.CreateAccount(account);
         return RedirectToAction("View", "BankAccount", newCustomer.Id);
     }
     AuditLogRepository.WriteEntries(auditLog);
     return View();
 }
예제 #3
0
 public void Save(Customer newCustomer)
 {
     throw new NotImplementedException();
 }
예제 #4
0
 public Customer CreateCustomer(Customer newCustomerToSave)
 {
     _customers.Add(newCustomerToSave);
     return newCustomerToSave;
 }
예제 #5
0
 public Account(Customer customer)
 {
     _holder = customer;
     Balance = 0;
 }
예제 #6
0
파일: Bank.cs 프로젝트: kylerader/Bank
 public bool CheckCredit(Customer customer)
 {
     return customer.FicoScore >= _minimumCreditScore;
 }