I want to extract a list using linq as tree structure.
{
"details": [
{
"description":"This is description 1",
"Name": "Name 1"
},
{
"description":"This is description 2",
"Name": "Name 2"
}
],
"price": 100
}
I have one detailsDto as List<> in hand which i will use it in Details field
properties from 'm' instance will be bind in detailsDto. that's where i am facing problem on how to do it. description and name field available in 'm' instance
var data = await Task.FromResult((
from c in _context.C
join mc in _context.MC on c.VId equals mc.VId
join m in _context.M on mc.Id equals m.mcId
where mc.Id == mcId && c.Id == CId
select new MainDto()
{
Price = mc.Price,
// Details =
}
).FirstOrDefault()
);