public MainViewModel() { apiService = new ApiService(); Teams = new ObservableCollection<TeamViewModel>(); NewTeam = new TeamViewModel(); //Teams.Add(new TeamViewModel() { Name = "Colombia", Flag= "http://rs575.pbsrc.com/albums/ss196/laurasgonzalez/ColombiaFlag.jpg~c200" }); LoadData(); }
internal async Task SaveTeamAsync(TeamViewModel team) { var serviceUrl = "http://worldcupdevcamp.azurewebsites.net/tables/teams"; team.Id = Guid.NewGuid().ToString(); using (var client = new HttpClient()) { var bodyRequest = JsonConvert.SerializeObject(team); client.DefaultRequestHeaders.Add("ZUMO-API-VERSION", "2.0.0"); var response = await client.PostAsync(serviceUrl, new StringContent(bodyRequest, System.Text.Encoding.UTF8, "application/json")); string result = await response.Content.ReadAsStringAsync(); } }