/// <summary> /// Delete a customer /// </summary> public void DeleteProductGroup(ProductGroup group) { db.ProductGroup.Remove(group); db.SaveChanges(); ProductGroups.Remove(group); }
/// <summary> /// Check if a product group is connected to any products /// </summary> /// <param name="productGroup"></param> /// <returns></returns> public bool IsProductGroupEmpty(ProductGroup productGroup) { var query = db.Product.Where(p => p.ProductGroupID.Equals(productGroup.ProductGroupID)); return(!query.Any()); }
public void ResetProductGroup(ProductGroup productGroup) { db.Entry(productGroup).State = EntityState.Unchanged; }