Exemplo n.º 1
0
        public void Delete(Product product)
        {
            using (ETradeContext contex = new ETradeContext())
            {
                var entity = contex.Entry(product);
                entity.State = EntityState.Deleted;

                contex.SaveChanges();
            }
        }
Exemplo n.º 2
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();
     }
 }