Exemplo n.º 1
0
        public string Insert(Customer customer)
        {
            using (var dbContext = new NorthwindEntities())
            {
                dbContext.Customers.Add(customer);
                dbContext.SaveChanges();

                return customer.CustomerID;
            }
        }
Exemplo n.º 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;
            }
        }