//example of retrieving case type lookup data from API endpoint public void instantiateCaseTypes() { HttpClient client = new HttpClient(); string json = client.getCaseTypes(); JArray caseTypeArray = JArray.Parse(json); IList<JToken> tokens = caseTypeArray.Children().ToList(); foreach (JToken token in tokens) { CaseType caseType = JsonConvert.DeserializeObject<CaseType>(token.ToString()); caseTypes.Add(caseType); } }
//example of retrieving court lookup data from API endpoint public void instantiateCourts() { HttpClient client = new HttpClient(); string json = client.getCourts(); JArray courtArray = JArray.Parse(json); IList<JToken> tokens = courtArray.Children().ToList(); foreach (JToken token in tokens) { Court court = JsonConvert.DeserializeObject<Court>(token.ToString()); courts.Add(court); } }