public void Create(Product product) { if (product != null) { Context.Products.Add(product); } }
public bool ProductInCategory(Product product, ProductCategory category) { if (product == null || category == null) { return false; } ProductCategory productCategory = product.ProductCategory; while (productCategory != null) { if (productCategory.Id == category.Id) { return true; } productCategory = productCategory.ParentCategory; } return false; }
public void VerifyProduct(Product product) { product.Verified = true; }
public void AddToCategory(Product product, ProductCategory category) { product.ProductCategory = category; category.CategoryMembers.Add(product); }
public void Update(Product product) { Context.Entry(product).State = EntityState.Modified; }