Ejemplo n.º 1
0
 public void Update(Product product)
 {
     using (BtkAkademiContext context = new BtkAkademiContext())
     {
         //var entity gönderilen bilgilerdeki product'ı veritabanında bulur
         context.Entry(product).State = EntityState.Modified; // bulunan nesneyi modifiye eder
         context.SaveChanges();
     }
 }
Ejemplo n.º 2
0
 public void Delete(Product product)
 {
     using (BtkAkademiContext context = new BtkAkademiContext())
     {
         //var entity gönderilen bilgilerdeki product'ı veritabanında bulur
         var entity = context.Entry(product);
         entity.State = EntityState.Deleted; // bulunan nesneyi siler
         context.SaveChanges();
     }
 }