Beispiel #1
0
 public void addProduct(Products product)
 {
     using (var context = new CustomerProductDbContext())
     {
         context.Products.Add(product);
         context.SaveChanges();
     }
 }
Beispiel #2
0
 public void updateCustomer(VCustomerUpdate updateCustomer)
 {
     using (var context = new CustomerProductDbContext())
     {
         context.VCustomerUpdate.Update(updateCustomer);
         context.SaveChanges();
     }
 }
Beispiel #3
0
        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();
            }
        }
Beispiel #4
0
        public void deleteProduct(int id)
        {
            var product = new Products
            {
                ProductId = id
            };

            using (var context = new CustomerProductDbContext())
            {
                context.Remove <Products>(product);
                context.SaveChanges();
            }
        }
Beispiel #5
0
        public void deleteCustomer(int id)
        {
            var customer = new Customers
            {
                CustomerNumber = id
            };

            using (var context = new CustomerProductDbContext())
            {
                context.Remove <Customers>(customer);
                context.SaveChanges();
            }
        }