Beispiel #1
0
        public object DeleteProductCategoryById(int id)
        {
            IProductCategoryService productCategoryService = new ProductCategoryService();

            var productCategory = productCategoryService.GetProductCategoryById(id);

            if (productCategory != null)
            {
                //WHERE Lft BETWEEN @MyLeft AND @MyRight;
                var all =
                    productCategoryService.GetProductCategory().Where(
                        s => s.Lft >= productCategory.Lft && s.Rgt <= productCategory.Rgt);
                IProductService productService = new ProductService();
                foreach (ProductCategoryInfo productCategoryInfo in all)
                {
                    productService.DeleteProductByCategoryId(productCategory.Id);
                }
            }

            return(productCategoryService.DeleteById(id));
        }