private string urlBreedCreator(SearchBreedModal model) { StringBuilder url = new StringBuilder(baseAddress); url.Append("images/search?breed_ids="); if (model.SelectedId != null) { url.Append(model.SelectedId); } return(url.ToString()); }
public IList <BreedInfoModel> GetBreeds(SearchBreedModal model) { using (HttpClient ApiClient = new HttpClient()) { string jsonResult = ApiClient.GetStringAsync(urlBreedCreator(model)).Result; var list = JsonConvert.DeserializeObject <List <BreedModel> >(jsonResult); var propertiesList = list.Select(c => new BreedInfoModel { name = c.breeds[0].name, temperament = c.breeds[0].temperament, origin = c.breeds[0].origin, description = c.breeds[0].description, url = c.url }).ToList(); return(propertiesList); } }