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); }
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); }
public bool Validate(AddAccountModel model) { return(IsDuplicateName(model.CompanyName)); }