public void Delete(Product product) { using (ETradeContext context = new ETradeContext()) { /*benim gönderdiğim prdocuct u vt deki prod ile eşitliyor*/ var entity = context.Entry(product); entity.State = EntityState.Deleted; context.SaveChanges(); } }
public void Add(Product product) { using (ETradeContext context = new ETradeContext()) { context.products.Add(product);/*bunu yazmak yerine soyle de yazabilirim; * var entity = context.Entry(product); * entity.State = EntityState.Added; */ context.SaveChanges(); } }