Guest User

Untitled

a guest
Apr 24th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. public override void OnCreate(Bundle savedInstanceState)
  2. {
  3. base.OnCreate(savedInstanceState);
  4.  
  5. // Create your fragment here
  6.  
  7. List<Listings> listings = new List<Listings>();
  8.  
  9. HttpClient client = new HttpClient();
  10. client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
  11. try
  12. {
  13. HttpResponseMessage response = client.GetAsync("http://111.111.14.1/api/Data/Persons").Result;
  14. if (response.IsSuccessStatusCode)
  15. {
  16. listings = JsonConvert.DeserializeObject<Listings[]>(response.Content.ReadAsStringAsync().Result).ToList();
  17. }
  18. }
  19. catch (Exception ex)
  20. {
  21.  
  22. }
  23. }
  24.  
  25. class Listings
  26. {
  27. public int AdvertId { get; set; }
  28. public int SearchId { get; set; }
  29. public string Url { get; set; }
  30.  
  31. public string ListingTitle { get; set; }
  32. public string ListingPrice { get; set; }
  33. public bool PriceIsFixed { get; set; }
  34. public string Location { get; set; }
  35. public string Description { get; set; }
  36. public string ImageUrl { get; set; }
  37. public DateTime PublishDate { get; set; }
  38. public bool RemovedByUser { get; set; }
  39. public bool SavedByUser { get; set; }
  40.  
  41. public Listings()
  42. {
  43. PriceIsFixed = true;
  44. RemovedByUser = false;
  45. SavedByUser = false;
  46. }
  47. }
Add Comment
Please, Sign In to add comment