Using the GET method to show banks from the DB in the DataGridview but it doesn't show anything. Why?
<pre>namespace BankData { [Newtonsoft.Json.JsonObject("ResultData")] public class ResultData { public string Name { get; set; } public List<Bank> RresultObject { get; set; } public string UUId { get; set; } [Newtonsoft.Json.JsonProperty("FirstName")] public string FirstName { get; set; } public string LastName { get; set; } public string address { get; set; } public string tel { get; set; } public string Marital_status { get; set; } public string Occupation { get; set; } public string PayIN { get; set; } } }
public ResultData getAllBank() { ResultData resultData = new ResultData(); resultData.Name = "AllBank"; List<Bank> banks = new List<Bank>(); banks.AddRange(DataBaseService.getBank()); resultData.RresultObject = banks; return resultData; }
async Task<object> GetBanktAsync(string path) { HttpClient client = new HttpClient(); HttpResponseMessage response = await client.GetAsync(path); object result=null; if (response.IsSuccessStatusCode) { result = response.Content.ReadAsAsync<object>().Result; } return result; }
Then Load Manager: private async void Manager_Load(object sender, EventArgs e) { try { var resultString = await GetBanktAsync("http://localhost:35799/bank"); var deserializeObject = Newtonsoft.Json.JsonConvert.DeserializeObject<object>(resultString.ToString()); dataGridViewBank.DataSource = deserializeObject; } catch (Exception ex) { }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)