Exemplo n.º 1
0
        //create cinnection to the DB //get DB context
        //Create new customer
        //add customer to db
        //save db


        public bool CreateCustomer(string first, string last)
        {
            using (var ctx = new BANK_DBEntities())
            {
                var entity =
                    new Customer
                {
                    FirstName = first,
                    LastName  = last
                };

                ctx.Customers.Add(entity);

                return(ctx.SaveChanges() == 1);
            }
        }
Exemplo n.º 2
0
        public bool CreateAccount(int acctNum, int pin, int custID, int acctBal)
        {
            using (var ctx = new BANK_DBEntities())
            {
                var entity =
                    new Account
                {
                    AccountNumber = acctNum,
                    PIN           = pin,
                    Balance       = acctBal,
                    CustomerID    = custID
                };

                ctx.Accounts.Add(entity);

                return(ctx.SaveChanges() == 1);
            }
        }