public static Category DefaultCategory(Category parent, int position) { return new Category { Parent = parent, Position = position }; }
public virtual void RemoveCategory(Category category) { var productCategory = ProductCategories .Where(pc => pc.Category.Id == category.Id) .SingleOrDefault(); if (productCategory == null) return; ProductCategories.Remove(productCategory); }
public static Product DefaultProduct(Category parentCategory, int position) { var product = new Product { Id = 0, Position = position }; product.ProductCategories.Add(new ProductCategory { Category = parentCategory }); return product; }
public virtual void AddCategory(Category category) { var productCategory = new ProductCategory {Category = category, Product = this}; ProductCategories.Add(productCategory); category.ProductCategories.Add(productCategory); }
public virtual void AddCategory(Category category, int position) { var productCategory = new ProductCategory { Category = category, Product = this, Position = position }; ProductCategories.Add(productCategory); category.ProductCategories.Add(productCategory); }
partial void DeleteCategory(Category instance);
partial void UpdateCategory(Category instance);
partial void InsertCategory(Category instance);
private void detach_Categories(Category entity) { this.SendPropertyChanging(); entity.Category1 = null; }
private void attach_Categories(Category entity) { this.SendPropertyChanging(); entity.Category1 = this; }