private async Task SearchAsync() { bool searchPossible = SearchText.IsNeitherNullNorEmpty(); switch (SelectedIndex) { case 0: People = searchPossible ? await _peopleRepository.SearchPeopleAsync(SearchText) : await _peopleRepository.GetAllPeopleAsync(); _activeSearch = 0; break; case 1: Starships = searchPossible ? await _starshipRepository.SearchStarships(SearchText) : await _starshipRepository.GetAllStarshipsAsync(); _activeSearch = 1; break; case 2: Films = searchPossible ? await _filmRepository.SearchFilms(SearchText) : await _filmRepository.GetAllFilms(); _activeSearch = 2; break; case 3: Planets = searchPossible ? await _planetRepository.SearchPlanets(SearchText) : await _planetRepository.GetAllPlanetsAsync(); _activeSearch = 3; break; case 4: Vehicles = searchPossible ? await _vehiclesRepository.SearchVehicles(SearchText) : await _vehiclesRepository.GetAllVehiclesAsync(); _activeSearch = 4; break; case 5: Species = searchPossible ? await _speciesRepository.SearchSpecies(SearchText) : await _speciesRepository.GetAllSpeciesAsync(); _activeSearch = 5; break; } }