Пример #1
0
        public void SaveAccount(AddAccountModel model)
        {
            bool isValid = SaveFacade.Validate(model);

            if (!isValid)
            {
                throw new ArgumentException("An account with that name already exists");
            }

            IAccount account = SaveFacade.Apply(model);

            Service.AddAccount(account);
        }
Пример #2
0
        public IAccount Apply(AddAccountModel model)
        {
            IAccount account = new Account();

            account.AccountBalance = model.AccountBalance;
            account.CompanyName    = model.CompanyName;
            account.InterestRate   = model.InterestRate;
            account.IsActive       = model.IsActive;
            account.RecordId       = 0;

            account.GeneratePaymentSchedule(model.FirstDueDate, model.AmountDue);
            return(account);
        }
Пример #3
0
 public bool Validate(AddAccountModel model)
 {
     return(IsDuplicateName(model.CompanyName));
 }