private void cbArtists_SelectedIndexChanged(object sender, EventArgs e) { var artist = ((ComboBox) sender).SelectedItem.ToString(); var client = new ArtistServiceClient(); lblResult.Text = client.GetMembers(artist); }
private static void DoArtistServicePart() { var client = new ArtistServiceClient(); var counter = 1; var alternatives = client.GetAllArtists() .Select(x => new {MenuNumber = counter++.ToString(), Artist = x}) .ToList(); alternatives.ForEach(x => Console.WriteLine(x.MenuNumber + ". " + x.Artist)); Console.Write("Välj nummer: "); var input = Console.ReadLine(); var result = alternatives.Any(x => x.MenuNumber == input) ? client.GetMembers(alternatives.First(x => x.MenuNumber == input).Artist) : "Ingen artist på det nummret"; Console.WriteLine(result); }