Inheritance: ViewModelBase
Ejemplo n.º 1
0
        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();
        }
Ejemplo n.º 2
0
        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();
            }
        }