public List <Product> GetAll() { using (BTK_ETradeContext context = new BTK_ETradeContext()) { return(context.Products.ToList()); } }
public void Add(Product product) { using (BTK_ETradeContext context = new BTK_ETradeContext()) { context.Products.Add(product); context.SaveChanges(); } }
public void Delete(Product product) { using (BTK_ETradeContext context = new BTK_ETradeContext()) { var entity = context.Entry(product); entity.State = EntityState.Deleted; context.SaveChanges(); } }