void Insert(ShopEntities.Customer customer) { // use ShopEntities.Customer only in wrapper // if you later switch to another Customer dependency, // you just change this wrapper MyShopEntities.MyCustomers cust = new MyShopEntities.MyCustomers(); cust.CustName = customer.CustName; cust.IAddress = customerIAddress; cust.ShippingAddress = customer.ShippingAddress; InsertInternal(cust); }
public void CreateCustomer(string customerName, string homeAddress, string shippingAddress) { // NOTE that I renamed 'Customers' to 'Customer', since it holds information // to only one customer. 'Customers' implies a collection. Customer cust = new ShopEntities.Customer(); cust.CustName = "Sam"; cust.IAddress = "xyz"; cust.ShippingAddress = "xyz xyx xyz"; this.context.Customers.Add(cust); this.context.SubmitChanges(); }