Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public override void OnCreate(Bundle savedInstanceState)
- {
- base.OnCreate(savedInstanceState);
- // Create your fragment here
- List<Listings> listings = new List<Listings>();
- HttpClient client = new HttpClient();
- client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
- try
- {
- HttpResponseMessage response = client.GetAsync("http://111.111.14.1/api/Data/Persons").Result;
- if (response.IsSuccessStatusCode)
- {
- listings = JsonConvert.DeserializeObject<Listings[]>(response.Content.ReadAsStringAsync().Result).ToList();
- }
- }
- catch (Exception ex)
- {
- }
- }
- class Listings
- {
- public int AdvertId { get; set; }
- public int SearchId { get; set; }
- public string Url { get; set; }
- public string ListingTitle { get; set; }
- public string ListingPrice { get; set; }
- public bool PriceIsFixed { get; set; }
- public string Location { get; set; }
- public string Description { get; set; }
- public string ImageUrl { get; set; }
- public DateTime PublishDate { get; set; }
- public bool RemovedByUser { get; set; }
- public bool SavedByUser { get; set; }
- public Listings()
- {
- PriceIsFixed = true;
- RemovedByUser = false;
- SavedByUser = false;
- }
- }
Add Comment
Please, Sign In to add comment