コード例 #1
0
        static async Task ProgramStart()
        {
            InitializeClient();
            string               input     = "";
            List <PersonModel>   people    = new List <PersonModel>();
            List <PlanetModel>   planets   = new List <PlanetModel>();
            List <VehicleModel>  vehicles  = new List <VehicleModel>();
            List <StarshipModel> starships = new List <StarshipModel>();
            List <SpeciesModel>  species   = new List <SpeciesModel>();
            List <FilModel>      films     = new List <FilModel>();

            input = StartMenu();

            try
            {
                switch (input.ToLower())
                {
                case "a":
                    people = await CharacterController.GetAllPeople();

                    await CharacterController.DisplayAllCharacters(people);

                    break;

                case "b":
                    planets = await PlanetController.GetAllPlanets();

                    await PlanetController.DisplayAllPlanets(planets);

                    break;

                case "c":
                    vehicles = await VehicleController.GetAllVehicles();

                    await VehicleController.DisplayAllVehicles(vehicles);

                    break;

                case "d":
                    starships = await StarshipController.GetAllStarships();

                    await StarshipController.DisplayAllStarships(starships);

                    break;

                case "e":
                    species = await SpeciesController.GetAllSpecies();

                    await SpeciesController.DisplayAllSpecies(species);

                    break;

                case "f":
                    films = await FilmController.GetAllFilms();

                    await FilmController.DisplayAllFilms(films);

                    break;

                default:
                    Console.WriteLine("Invalid input");
                    break;
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Error: { ex.Message }");
            }
        }