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."); } }
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); }