public void UpdateProduct(Product product) { using (var context = new GrovityContext()) { context.Entry(product).State = EntityState.Modified; context.SaveChanges(); } }
public void UpdateCategory(Category category) { using (var context = new GrovityContext()) { context.Entry(category).State = EntityState.Modified; context.SaveChanges(); } }
public void SaveProduct(Product product) { using (var context = new GrovityContext()) { context.Entry(product.Category).State = EntityState.Unchanged; context.Products.Add(product); context.SaveChanges(); } }