public StarshipListViewModel() { Starships = new ObservableCollection <Starship>(); SWApi.GetStarshipsAsync(starships => { foreach (var starship in starships) { Starships.Add(starship); } }); }
static void Main() { WebClient wc = new WebClient(); Console.WriteLine("Enter one Star Wars Character:"); string character = Console.ReadLine(); string url = $"https://swapi.co/api/people/?search" + $"={character}"; string json = wc.DownloadString(url); SWApi apiResponse = JsonConvert.DeserializeObject <SWApi>(json); foreach (Character result in apiResponse.Results) { Console.WriteLine(result.Name + " Has appeared in " + result.Films.Length + " films"); } Console.ReadKey(); }
public RegistrationController() { swApi = new SWApi(); }