Example #1
0
        public void Add(Product entity)
        {
            var addedEntity = _eTradeContext.Entry(entity);

            addedEntity.State = EntityState.Added;
            _eTradeContext.SaveChanges();
        }
Example #2
0
 public void Delete(Product product)
 {
     using (ETradeContext context = new ETradeContext())
     {
         var entity = context.Entry(product);
         entity.State = EntityState.Deleted;
         context.SaveChanges();
     }
 }