コード例 #1
0
        public ShoppingCart Sell <T>(T requestedItem, int quantity) where T : BaseItem
        {
            var discount = DiscountHelper.GetDiscount(quantity);

            return(new ShoppingCart
            {
                Item = requestedItem,
                PurchaseQuantity = quantity,
                PurchaseDiscount = discount,
                PurchaseAmount = requestedItem.Price * DiscountHelper.ApplyDiscount(discount) * quantity
            });
        }