예제 #1
0
        public long BuyItemInThisShop(ItemInCurrentShop item, long quantity)
        {
            if (item.Quantity - quantity >= 0)
            {
                item.BuyItems(quantity);

                return(quantity * item.PriceOfItem);
            }
            else
            {
                throw new ItemDoesntContainsException("This shop doesn't contain enough items you are looking for.");
            }
        }
예제 #2
0
        public bool DoesThisItemExistHere(string itemId, out ItemInCurrentShop item)
        {
            item = null;

            foreach (String id in items.Keys)
            {
                if (id == itemId)
                {
                    items.TryGetValue(itemId, out item);
                    return(true);
                }
            }

            return(false);
        }