public void Write(Product product) { using (PointOfSaleContext context = new PointOfSaleContext()) { context.Products.AddOrUpdate(product); context.SaveChanges(); } }
public void DeleteByProductCode(int productCode) { using (PointOfSaleContext context = new PointOfSaleContext()) { Product product = (from p in context.Products where p.ProductCode == productCode select p).FirstOrDefault(); if (product != null) { context.Products.Remove(product); context.SaveChanges(); } } }