Пример #1
0
        public static Customer CreateCustomer(string name, int ssn, string address, string emailAdd)
        {
            using (var db = new ShopModel())
            {
                var cust = new Customer();      //same        //Customer customer = new Customer()
                cust.Name = name;
                cust.SSN = ssn;
                cust.Address = address;
                cust.EmailAddress = emailAdd;

                db.Customers.Add(cust);
                db.SaveChanges();
                return cust;
            }
        }
Пример #2
0
        public static Customer CreateCustomer(string name, int ssn, string address, string email)
        {
            using (var db = new ShopModel())
            {
                var c = new Customer();
                c.Name = name;
                c.SSN = ssn;
                c.Address = address;
                c.EmailAddress = email;

                db.Customers.Add(c);
                db.SaveChanges();
                return c;
            }
        }