❔ How to get all children of parent node?
I have a DTO as image. I want to get all children (included children of child) . How can I achive this ? Thanks
6 Replies
what children?
i don't see any there
I think you'll need something like
dbContext.Nodes.Where(node => node.ParentId == id)
and then also do that for all of those children
something like this
of course assuming you're using Entity Framework (or this isn't a database at all){
"data": [
{
"id": 2,
"name": "General",
"parentId": "0"
},
{
"id": 3,
"name": "Fruits",
"parentId": "2"
},
{
"id": 6,
"name": "Vegetables",
"parentId": "2"
},
{
"id": 12,
"name": "Apple",
"parentId": "3"
}
],
"success": true,
"messages": null
}
i see
yeah you wanna do what thinkger suggested
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.