public async Task <List <Comment> > GetCommentsAPIAsync() { if (SetConnectionStatus()) { Comments = await GetApiData.LoadApiCommentsAsync(); } return(Comments); }
/// <summary> /// Is connection status true, get rates data from GetApiData Class /// </summary> /// <returns>List of Rate</returns> public async Task <List <Rate> > GetRatesAPIDataAsync() { dataBaseServices = new DataBaseServices(); if (SetConnectionStatus()) { Rates = await GetApiData.LoadRatesFromAPIAsync(); } else { Rates = dataBaseServices.GetRatesData(); } return(Rates); }
/// <summary> /// This method searches for an internet connection. If connection is valid gets data from API, if not gets data from Databse /// </summary> /// <returns>List of Country</returns> public async Task <List <Country> > ReturnCountriesData() { dataBaseServices = new DataBaseServices(); SetConnectionStatus(); if (SetConnectionStatus()) { Countries = await GetApiData.LoadCountriesFromAPIAsync(); } else { MessageService.ShowMessage("Error", "Set up your Internet connection"); Countries = dataBaseServices.GetCountriesData(); } if (!SetConnectionStatus()) { if (Countries.Count == 0) { MessageService.ShowMessage("Error", "First use of this application requires a valid internet connection"); } } return(Countries); }