async Task ExecuteLoadCasesCommand() { try { lstCases.Clear(); AdoptDatabase caseDatabase = new AdoptDatabase(); var cases = await caseDatabase.GetCases(); foreach (var child in cases) { lstCases.Add(child); } } catch (Exception ex) { Debug.WriteLine(ex); } }
public void GetCases() { try { AdoptDatabase caseDatabase = new AdoptDatabase(); var cases = caseDatabase.GetCases().Result; if (cases != null && cases.Count > 0) { lstCases = new ObservableCollection <Case>(); foreach (var child in cases) { lstCases.Add(new Case { CaseNum = child.CaseNum, Pic = child.Pic, Description = child.Description, Group = child.Group, Name = child.Name, Age = child.Age, Gender = child.Gender, State = child.State, Race = child.Race, Language = child.Language, Bio = child.Bio, Interests = child.Interests }); } lblInfo = "Total " + cases.Count.ToString() + " record(s) found"; } else { lblInfo = "No case records found. Please add one"; } } catch (Exception ex) { lblInfo = ex.Message.ToString(); } }