Esempio n. 1
0
 public static CustomerAccount CreateAccount(string custname, int driv_lic, decimal amount, AccountType accountType)
 {
     using (var db = new CarRentalModel())
     {
         CustomerAccount custaccount = new CustomerAccount(custname, amount);
         custaccount.DrivingLicense = driv_lic;
         custaccount.TypeOfAccount = accountType;
         //custaccounts.Add(custaccount);
         db.CustomerAccounts.Add(custaccount);
         db.SaveChanges();
         return custaccount;
     }
 }
Esempio n. 2
0
        //private static List<CustomerAccount> custaccounts = new List<CustomerAccount>();
        public static CustomerAccount CreateAccount(string custname, int driv_lic)
        {
            using (var db = new CarRentalModel())
            {

                var custaccount = new CustomerAccount(custname);
                custaccount.DrivingLicense = driv_lic;
                //custaccounts.Add(custaccount);

                //adds a row to the database, or entry to the table
                db.CustomerAccounts.Add(custaccount);
                db.SaveChanges();
                return custaccount;
            }
        }