Пример #1
0
 /// <summary>
 /// Creates a bank account
 /// </summary>
 /// <param name="name">Name of the account holder</param>
 /// <param name="ssn">ssn</param>
 /// <param name="balance">initial balance to be deposited</param>
 /// <returns>Account number</returns>
 public static Account CreateAccount(string name, int ssn, double balance)
 {
     Account account = new Account(name);
     account.SSN = ssn;
     account.AccountType = TypeOfAccount.Checking;
     if (balance > 0)
     {
         account.Deposit(balance);
     }
     return account;
 }
Пример #2
0
 /// <summary>
 /// Creates a bank account
 /// </summary>
 /// <param name="name">Name of the account holder</param>
 /// <param name="ssn">ssn</param>
 /// <param name="balance">initial balance to be deposited</param>
 /// <returns>Account number</returns>
 public static Account CreateAccount(string name, int ssn, double balance)
 {
     using (var db = new BankModel())
     {
         Account account = new Account(name);
         account.SSN = ssn;
         account.AccountType = TypeOfAccount.Checking;
         if (balance > 0)
         {
             account.Deposit(balance);
         }
         accounts.Add(account);
         db.Accounts.Add(account);
         db.SaveChanges();
         return account;
     }
 }