Пример #1
0
        private void CheckifProductNotInCategory(Product P, string categoryID)
        {
            LinkedList <Product> products = DataLayerInstance.GetAllCategoryProducts(categoryID);

            foreach (Product product in products)
            {
                if (P.Equals(product))
                {
                    throw new StoreException(StoreEnum.ProductAlreadyInCategory, "Product alrady exists in category, ");
                }
            }
        }
Пример #2
0
        private void CheckifProductInCategory(Product product, string categoryName)
        {
            LinkedList <Product> products = DataLayerInstance.GetAllCategoryProducts(categoryName);
            bool check = false;

            foreach (Product aProduct in products)
            {
                if (product.Equals(aProduct))
                {
                    check = true;
                }
            }

            if (!check)
            {
                throw new StoreException(StoreEnum.ProductNotInCategory, "Product not exists in category, ");
            }
        }