private void ReadPokemonById()
        {
            Pokemon pokemonInfo = repo.ReadById(io.PromptUserForInt("Enter Id"));
            pokemonInfo.Name = "Bob";


            if (pokemonInfo != null)
            {
                io.DisplayPokemon(pokemonInfo);
                // Update Character
                UpdatePokemon(pokemonInfo);
            }
        }
        private void ReadCharacterById()
        {
            Character characterInfo = repo.ReadById(io.PromptUserForInt("Enter Id"));

            characterInfo.Name = "Bob";


            if (characterInfo != null)
            {
                io.DisplayCharacter(characterInfo);
                // Update Character
                UpdateCharacter(characterInfo);
            }
        }
Ejemplo n.º 3
0
        public void Execute()
        {
            Console.Clear();

            EditOrderDate();

            userId = io.PromptUserForInt("What order would you like to edit: ");

            ConfirmEditOrder();
        }
Ejemplo n.º 4
0
        private void ShopItem()
        {
            // WHo are you?
            Character c = _characterService.ReadByCharacterId(io.PromptUserForInt("What is your character's id?"));

            // Oh Hello... character
            io.DisplayCharacter(c);


            // have a look at my wares
            bool keepGoing = true;

            do
            {
                try
                {
                    io.DisplayItems(_characterService.RetrieveAvailableItems());

                    //What would you like to buy?
                    int itemId = io.PromptUserForInt("Select Item");

                    // attempt a sale
                    _characterService.BuyItem(c.Id, itemId);
                    keepGoing = false;
                }
                catch (NoItemAvailableException e)
                {
                    io.Display(e.Message);
                    keepGoing = false;
                }
                catch (Exception e)
                {
                    // you've done something wrong!
                    io.Display(e.Message);
                    if (c.Gold <= 0)
                    {
                        keepGoing = false;
                    }
                }
            } while (keepGoing);
        }
Ejemplo n.º 5
0
        public void Execute()
        {
            bool isValidDate = false;
            bool idValid     = false;

            int userId = 0;

            Console.Clear();

            while (isValidDate == false)
            {
                dateString      = io.PromptUserForDate("What date would you like to look up: ");
                userDate        = DateTime.ParseExact(dateString, "MMddyyyy", CultureInfo.GetCultureInfo("en-us"));
                displayResponse = manager.DisplayOrders(dateString);

                if (displayResponse.Success == true)
                {
                    foreach (Order order in displayResponse.Orders)
                    {
                        io.DisplayOrder(order, userDate);
                    }
                    isValidDate = true;
                }
            }

            userId = io.PromptUserForInt("What order would you like to remove: ");

            while (idValid == false)
            {
                foreach (Order order in displayResponse.Orders)
                {
                    if (userId == order.OrderNumber)
                    {
                        ConfirmRemoveOrder(order);
                        idValid = true;
                        break;
                    }
                    else
                    {
                        Console.WriteLine("Please enter a vaild order number");
                    }
                }
            }
        }