static void Main(string[] args)
        {
            var bank           = new Bank();
            var customer       = new Customer();
            var creditContract = new CreditContract()
            {
                Amount           = 120000,
                DurationInMonths = 24
            };

            var credit = bank.GiveCredit(customer, creditContract);

            if (credit == null)
            {
                Console.WriteLine("Qez merjel en.");
            }
            else
            {
            }

            var depositContract = new DepositContract()
            {
                Amount           = 100000,
                DurationInMonths = 5
            };

            var deposit = bank.TakeDeposit(customer, depositContract);
        }
Ejemplo n.º 2
0
        public Deposit TakeDeposit(Customer customer, DepositContract depositContract)
        {
            if (customer.Approved == false)
            {
                return(null);
            }
            if (depositContract.Amount > this.MaxAmount || depositContract.Amount < this.MinAmount)
            {
                return(null);
            }
            Deposit deposit = new Deposit(this, customer)
            {
                StartDate        = DateTimeOffset.Now,
                DurationInMonths = depositContract.DurationInMonths,
                TotalAmount      = depositContract.Amount,
                PeriodInMonths   = 1,
            };

            return(deposit);
        }