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

                contex.SaveChanges();
            }
        }
예제 #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();
     }
 }