public void AddProduct(Product p) { try { using (prodigiousEntities _Model = new prodigiousEntities()) { _Model.Product.Add(p); _Model.SaveChanges(); } } catch (Exception ex) { Trace.WriteLine(ex.Message); throw ex; } }
public static void UpdateProduct(Product product) { using (var context = new NorthwindEntities()) { try { context.Entry(product).State = EntityState.Modified; context.SaveChanges(); } catch (EntityException entityExcp) { Logger.Write(entityExcp); return; } } }