Exemplo n.º 1
0
        public Stock(ComponentCollection collection, bool reverse = false)
        {
            this._collection = collection;
            this._reverse    = reverse;

            if (reverse)
            {
                this._position = collection.getItems().Count;
            }
        }
Exemplo n.º 2
0
        public void Execute()
        {
            _client.Builder = new Computer();
            Console.WriteLine("Choose you configuration\n1-Home\n2-Proffesional\n3-Show parts in stock\n4-Create you own configuration\n5-Exit");
            int x = 0;

            while (true)
            {
                if (int.TryParse(Console.ReadLine(), out x))
                {
                    if (x == 5)
                    {
                        break;
                    }
                    switch (x)
                    {
                    case 1: _client.BuildHome(); _client.GetCost(); break;

                    case 2: _client.BuildProfessional(); _client.GetCost(); break;

                    case 3: foreach (var component in _collection.getItems())
                        {
                            Console.WriteLine($"{component.Name} - {component.Description} - {component.Price}");
                        }
                        ; break;

                    case 4: _client.BuildConfiguraton(); break;

                    default: Console.WriteLine("Invalid number"); break;
                    }
                }
                else
                {
                    Console.WriteLine("Incorrect value");
                }
            }
        }