I have this return
code from an async
function:
return await _context.Models.ToListAsync();
That is successful in returning this:
[
{
"id":"id",
"name":"name",
"url":"url",
"components":[]
}
]
Now, I want NOT to show the components
like this.
[
{
"id":"id",
"name":"name",
"url":"url"
}
]
So far, I tried:
return await _context.Models.Select( p => new Model {
Id = p.Id, Name = p.Name, Url = p.Url
}).ToListAsync();
But it will still show components
and only do nullify its value.