I have response api with header, parent and child like this :
{
"data": [
{
"id": 40,
"organizerName": "Dr. Jamarcus Wisoky",
"imageLocation": "https://lorempixel.com/640/480/?76615"
},
{
"id": 42,
"organizerName": "Kyra Goldner DVM",
"imageLocation": "https://lorempixel.com/640/480/?98636"
},
{
"id": 43,
"organizerName": "Emmet Johnston PhD",
"imageLocation": "https://lorempixel.com/640/480/?89681"
},
{
"id": 44,
"organizerName": "Mr. Erin Yost",
"imageLocation": "https://lorempixel.com/640/480/?37024"
},
{
"id": 46,
"organizerName": "Delphine D'Amore",
"imageLocation": "https://lorempixel.com/640/480/?72831"
},
{
"id": 47,
"organizerName": "Myriam Wilderman",
"imageLocation": "https://lorempixel.com/640/480/?83244"
},
{
"id": 48,
"organizerName": "Tina Moore",
"imageLocation": "https://lorempixel.com/640/480/?27110"
},
{
"id": 54,
"organizerName": "Tierra Kautzer Jr.",
"imageLocation": "https://lorempixel.com/640/480/?55773"
},
{
"id": 55,
"organizerName": "Lonie Cronin",
"imageLocation": "https://lorempixel.com/640/480/?66732"
},
{
"id": 56,
"organizerName": "Gonzalo Turcotte",
"imageLocation": "https://lorempixel.com/640/480/?11499"
}
],
"meta": {
"pagination": {
"total": 161,
"count": 10,
"per_page": 10,
"current_page": 1,
"total_pages": 17,
"links": {
"next": "https://api-sport-events.php6-02.test.voxteneo.com/api/v1/organizers?page=2"
}
}
}
}
and the class model like this:
public class Data
{
public List<Organizers> data { get; set; }
}
public class Meta
{
public List<pagination> data { get; set; }
}
public class pagination
{
public int total { get; set; }
public int count { get; set; }
public int per_page { get; set; }
public int current_page { get; set; }
public int total_pages { get; set; }
public List<Links> next { get; set; }
}
public class Links
{
public string nexts { get; set; }
}
public class Organizers
{
[Key]
[Column(Order = 0)]
[DatabaseGenerated(DatabaseGeneratedOption.None)]
public int id { get; set; }
public string organizerName { get; set; }
public string imageLocation { get; set; }
}
i have stuck when i only get the parent only using this metod:
public async Task<IActionResult> Index()
{
List<Organizers> list = new();
var response = await _organizersService.GetAllAsync<APIResponse>(HttpContext.Session.GetString(SD.SessionToken));
if (response != null && response.IsSuccess)
{
list = JsonConvert.DeserializeObject<List<Organizers>>(Convert.ToString(response.Data));
}
return View(list);
}
need some help for this one.