コード例 #1
0
 public void AddBoothToList(IBooth booth)
 {
     _repoBooths.Add(booth);
 }
コード例 #2
0
        public void Run()
        {
            _booths  = _boothRepo.GetAllBooths();
            _parties = _boothRepo.GetParties();
            _boothRepo.SeedData();
            Console.WriteLine("Welcome to the Komodo Party Planning Committee!");
            bool isRunning = true;

            while (isRunning)
            {
                _boothRepo.GetBoothTickets();
                Console.WriteLine("What would you like to do?\n\t" +
                                  "1. Create a new booth \n\t" +
                                  "2. Create a new party\n\t" +
                                  "3. See party details\n\t" +
                                  "4. See total tickets per booth\n\t" +
                                  "5. See all parties\n\t" +
                                  "6. Exit");
                var menuResponse = int.Parse(Console.ReadLine());
                switch (menuResponse)
                {
                case 1:
                    Console.WriteLine("What kind of booth would you like to create?\n\t1. Burger\n\t2. Dessert");
                    var boothTypeResponse = int.Parse(Console.ReadLine());
                    _booth = _boothMaker.GetBooth(boothTypeResponse, GetBoothName(), GetMainItemCost(boothTypeResponse), _boothRepo.GetMiscCost(boothTypeResponse));
                    _boothRepo.AddBoothToList(_booth);
                    break;

                case 2:
                    Console.WriteLine("What is the name of your party?");
                    var name = Console.ReadLine();

                    _burgers  = _boothRepo.GetBurgerBooths();
                    _desserts = _boothRepo.GetDessertBooths();

                    Console.WriteLine("Which Burger booth did your party have?");
                    PrintBooths(_burgers);
                    var burgerChoiceInt = int.Parse(Console.ReadLine());
                    var burgerChoice    = _burgers[burgerChoiceInt - 1];

                    Console.WriteLine($"How many tickets did {burgerChoice.BoothName} recieve?");
                    var burgerTix = int.Parse(Console.ReadLine());

                    Console.WriteLine("Which Dessert booth did your party have?");
                    PrintBooths(_desserts);

                    var dessertChoiceInt = int.Parse(Console.ReadLine());
                    var dessertChoice    = _desserts[dessertChoiceInt - 1];

                    Console.WriteLine($"How many tickets did {dessertChoice.BoothName} recieve?");
                    var dessertTix = int.Parse(Console.ReadLine());

                    Party party = new Party(name, burgerChoice, burgerTix, dessertChoice, dessertTix);
                    _boothRepo.AddPartyToList(party);
                    break;

                case 3:
                    int i = 1;
                    if (_parties.Count != 0)
                    {
                        Console.WriteLine("Which party do you need details on?");
                        foreach (Party p in _parties)
                        {
                            Console.WriteLine($"{i}. {p.PartyName}");
                            i++;
                        }
                        var input = int.Parse(Console.ReadLine());
                        Console.WriteLine(_parties[input - 1]);
                    }
                    else
                    {
                        Console.WriteLine("There are no parties.");
                    }
                    break;

                case 4:
                    Console.WriteLine("Booth Name\tTickets Taken");
                    foreach (IBooth booth in _booths)
                    {
                        Console.WriteLine($"{booth.BoothName}: {booth.TicketsTaken}");
                    }
                    Console.ReadLine();
                    break;

                case 5:
                    foreach (Party p in _parties)
                    {
                        Console.WriteLine($"{p.PartyName}");
                    }
                    Console.ReadLine();
                    break;

                default:
                    isRunning = false;
                    break;
                }
                Console.Write("Press any key to continue...");
                Console.ReadKey();
                Console.Clear();
            }
        }