예제 #1
0
        public string Insert(Customer customer)
        {
            using (var dbContext = new NorthwindEntities())
            {
                dbContext.Customers.Add(customer);
                dbContext.SaveChanges();

                return customer.CustomerID;
            }
        }
예제 #2
0
        public string Insert(string customerID, string companyName)
        {
            using(var dbContext = new NorthwindEntities())
            {
                var customer = new Customer()
                {
                    CustomerID = customerID,
                    CompanyName = companyName,
                };

                dbContext.Customers.Add(customer);
                dbContext.SaveChanges();

                return customer.CustomerID;
            }
        }