private async Task ExecuteSearchCheesesCommand(string s) { try { SearchCheesesCommand.ChangeCanExecute(); var searchedCheese = await _dataService.SearchCheeseAsync(s.ToString()); Cheeses.Clear(); foreach (var cheese in searchedCheese) { Cheeses.Add(cheese); } } catch (NoInternetException) { await Page.DisplayAlert("No Internet!", "Cannot Access The Internet!", "Darn!"); } finally { SearchCheesesCommand.ChangeCanExecute(); } }
private async Task ExecuteGetRecentCheesesCommand() { try { GetRecentCheesesCommand.ChangeCanExecute(); var recentCheese = await _dataService.GetRecentCheesesAsync(); Cheeses.Clear(); foreach (var cheese in recentCheese) { Cheeses.Add(cheese); } } catch (NoInternetException) { await Page.DisplayAlert("No Internet!", "Cannot Access The Internet!", "Darn!"); } finally { GetRecentCheesesCommand.ChangeCanExecute(); } }