private void btnInserir_Click(object sender, RoutedEventArgs e) { Models.Fabricante f = new Models.Fabricante { id = int.Parse(txtIdFab.Text), descricao = txtDesc.Text }; fabricantes.Add(f); lstFabricantes.Items.Add(f.ToString()); cmbFabricantes.ItemsSource = fabricantes; }
private async void btnInserir_Click(object sender, RoutedEventArgs e) { HttpClient httpClient = new HttpClient(); httpClient.BaseAddress = new Uri(ip); Models.Fabricante f = new Models.Fabricante { Descricao = txtDesc.Text }; string s = JsonConvert.SerializeObject(f); var content = new StringContent(s, Encoding.UTF8, "application/json"); await httpClient.PostAsync("/20131011110029/api/fabricante", content); }