Пример #1
0
        public void AddDiscount(ICategoryDiscount categoryDiscount)
        {
            if (categoryDiscount == null)
            {
                throw new ArgumentNullException("categoryDiscount cannot be null.");
            }

            _categoryDiscount = categoryDiscount;
        }
Пример #2
0
        private ICategoryDiscount CreateCategoryDiscount()
        {
            ICategoryDiscount categoryDiscount = null;

            if (this.Product.Category == ProductCategory.Accessories)
            {
                categoryDiscount = new AccessoriesDiscount();
            }
            if (this.Product.Category == ProductCategory.Bikes)
            {
                categoryDiscount = new BikesDiscount();
            }
            if (this.Product.Category == ProductCategory.Cloathing)
            {
                categoryDiscount = new CloathingDiscount();
            }
            return(categoryDiscount);
        }