コード例 #1
0
        public void Start()
        {
            BandRepo       bandRepo       = new BandRepo();
            BandController bandController = new BandController(bandRepo);

            BandRosterRepo  bandRoster      = new BandRosterRepo();
            RosterSelection rosterSelection = new RosterSelection(bandRoster);

            List <MemberRole> members = new List <MemberRole>();

            bool away = true;

            while (away)
            {
                PrintBandData();
                MenuPrint();

                var isNumeric  = int.TryParse(Console.ReadLine(), out int n);
                int caseSwitch = 999;
                if (isNumeric)
                {
                    caseSwitch = n;
                }

                switch (caseSwitch)
                {
                case 0:
                    Console.WriteLine("Good Bye!");
                    away = false;
                    break;

                case 1:
                    string GeneratedName = bandController.GenerateBandName();
                    Console.WriteLine(GeneratedName);
                    bandData.Name = GeneratedName;
                    BottomMenu();
                    break;

                case 2:
                    string UserChoicedName = bandController.UserChoice();
                    Console.WriteLine(UserChoicedName);
                    SetBandNameByUser(UserChoicedName);
                    BottomMenu();
                    break;

                case 3:
                    members.Clear();
                    members = rosterSelection.CrateRoster();
                    PrintMembers(members);
                    bandData.Members = members;
                    BottomMenu();
                    break;

                case 4:
                    Console.WriteLine("Select band leader");
                    PrintMembers(bandData.Members);
                    rosterSelection.SelectLeader();
                    BottomMenu();
                    break;

                case 5:
                    Console.WriteLine("At this time we have " + bandController.GetAdjectivesCount() + " adjectives.");
                    bandController.WriteAdjectives();
                    BottomMenu();
                    break;

                case 6:
                    Console.WriteLine("At this time we have " + bandController.GetNounsCount() + " nouns.");
                    bandController.WriteNouns();
                    BottomMenu();
                    break;

                case 7:
                    Console.WriteLine("Add an adjective!");
                    bandController.AddNewAdjective();
                    BottomMenu();
                    break;

                case 8:
                    Console.WriteLine("Add a noun!");
                    bandController.AddNewNoun();
                    BottomMenu();
                    break;

                case 9:
                    Console.WriteLine("Select adjective to delete.");
                    bandController.WriteAdjectives();
                    bandController.RemoveAdjective();
                    BottomMenu();
                    break;

                case 10:
                    Console.WriteLine("Select noun to delete.");
                    bandController.WriteNouns();
                    bandController.RemoveNoun();
                    BottomMenu();
                    break;

                default:
                    Console.WriteLine("Wrong Choose.");
                    break;
                }
            }
        }
コード例 #2
0
 public BandController(BandRepo bandRepo)
 {
     this.bandRepo = bandRepo;
     StartUp();
 }