public async void FillPage() { HttpResponseMessage response = await GetProduct.GetProductsByRecommendations(); if (response.IsSuccessStatusCode) { string response_content = await response.Content.ReadAsStringAsync(); Products = JsonConvert.DeserializeObject <List <Product> >(response_content); MyCollectionView.ItemsSource = Products; } else { if (response.StatusCode == System.Net.HttpStatusCode.BadGateway) { await DisplayAlert("Try Again!", "No connection with the server", "OK"); } if (response.StatusCode == System.Net.HttpStatusCode.BadRequest) { await DisplayAlert("Try Again!", "Invalid request", "OK"); } } }