private async void Refresh() { LBL.Content = "Carregando dados..."; string jsonString = await RestHelper.GetALL(); DataTable dt = JsonConvert.DeserializeObject <DataTable>(jsonString); DG.ItemsSource = dt.DefaultView; LBL.Content = ""; }
private async void btnGetAll_Click(object sender, EventArgs e) { var responce = await RestHelper.GetALL(); var products = JsonConvert.DeserializeObject <List <Product> >(responce); productView.Rows.Clear(); foreach (var product in products) { DataGridViewRow row = (DataGridViewRow)productView.Rows[0].Clone(); row.Cells[0].Value = product.ProductID; row.Cells[1].Value = product.Name; row.Cells[2].Value = product.Price; row.Cells[3].Value = product.Stock; row.Cells[4].Value = product.Code; productView.Rows.Add(row); } productView.ReadOnly = true; }