public void addProduct(Products product) { using (var context = new CustomerProductDbContext()) { context.Products.Add(product); context.SaveChanges(); } }
public void updateCustomer(VCustomerUpdate updateCustomer) { using (var context = new CustomerProductDbContext()) { context.VCustomerUpdate.Update(updateCustomer); context.SaveChanges(); } }
public void addCustomer(Customers customer) { using (var context = new CustomerProductDbContext()) { Random r = new Random(); customer.CustomerNumber = r.Next(1000); context.Customers.Add(customer); context.SaveChanges(); } }
public void deleteProduct(int id) { var product = new Products { ProductId = id }; using (var context = new CustomerProductDbContext()) { context.Remove <Products>(product); context.SaveChanges(); } }
public void deleteCustomer(int id) { var customer = new Customers { CustomerNumber = id }; using (var context = new CustomerProductDbContext()) { context.Remove <Customers>(customer); context.SaveChanges(); } }