public void UpdateProduct(Product Product) { using (var context = new GeekHubContext()) { context.Entry(Product).State = System.Data.Entity.EntityState.Modified; context.SaveChanges(); } }
public void UpdateCategory(Category category) { using (var context = new GeekHubContext()) { context.Entry(category).State = System.Data.Entity.EntityState.Modified; context.SaveChanges(); } }
public void SaveCategory(Category category) { using (var context = new GeekHubContext()) { context.Categories.Add(category); context.SaveChanges(); //to enter in the database } }
public void DeleteProduct(int ID) { using (var context = new GeekHubContext()) { var Product = GetProduct(ID); context.Entry(Product).State = System.Data.Entity.EntityState.Deleted; context.SaveChanges(); } }
public void SaveProduct(Product product) { using (var context = new GeekHubContext()) { context.Entry(product.ProductCategory).State = System.Data.Entity.EntityState.Unchanged; context.Products.Add(product); context.SaveChanges(); //to enter in the database } }
public void DeleteCategory(int ID) { using (var context = new GeekHubContext()) { var category = GetCategory(ID); context.Entry(category).State = System.Data.Entity.EntityState.Deleted; context.SaveChanges(); } }