I have the following problem: the query with linq works ok, but I need to add the coordinates within an array for each record that is repeated
Model
public class AppPoisModel
{
public int idPoiType { get; set; }
public string sector { get; set; }
public double latPoint { get; set; }
public double lngPoint { get; set; }
}
Query
var result = (from c in db.coord
select new AppPoisModel
{
idPoiType = c.id,
sector = c.sector,
latPoint = c.latitude ?? 0,
lngPoint = c.longitude ?? 0
}).ToList();
Result
[
{
"$id": "1",
"sector" : "A",
"latPoint": 0,
"lngPoint": 0
},
{
"$id": "2",
"sector" : "A",
"latPoint": 0,
"lngPoint": 0
}
]
Desired result
[
{
"$id": "1",
"sector" : "A",
"coords": [{latPoint, lngPoint}, {latPoint, lngPoint}]
}
]
thank you very much for your contributions