Beispiel #1
0
 public void Add(Product product)
 {
     using (ETradeContext context = new ETradeContext()) {
         context.products.Add(product);
         context.SaveChanges();
     }
 }
Beispiel #2
0
        public void Delete(Product product)
        {
            using (ETradeContext contex = new ETradeContext())
            {
                var entity = contex.Entry(product);
                entity.State = EntityState.Deleted;

                contex.SaveChanges();
            }
        }
Beispiel #3
0
 public void Add(Product product)
 {
     using (ETradeContext contex = new ETradeContext())
     {
         var entity = contex.Entry(product);
         entity.State = EntityState.Added;
         // contex.Products.Add(product);
         contex.SaveChanges();
     }
 }