I have some ViewModel like this.
public class ModelResult
{
public string NAME { get; set; }
public List<DataPointVM> RESULTs { get; set; }
}
public class DataPointVM
{
private float v1;
private float v2;
public DataPointVM(float v1, float v2)
{
this.TIME = v1;
this.VALUE = v2;
}
public float TIME { get; set; }
public float VALUE { get; set; }
}
Then, I have a list key
List<string> parameterList = new List<string>(new string[] {
"Jhon",
"Andy",
"Ivan",
"Erick",
});
DataPoint ViewModel will store data like [{"Car1":"Bentley"},{"Car2":"Ferarri"}]
I try with this code but the result is only display last key (Erick)
example:[{"NAME":"ERICK","RESULTs":[{"car1":"xxx"},{"car2":"yyy"}]}]
ModelResult mdlres = new ModelResult();
for (index=0;index<parameterList.Count();index++)
{
List<DataPointVM> points = new List<DataPointVM>();
mdlres.NAME = parameterList[index];
for (int i = 0; i < 2; i++)
{
points.Add(new ViewModels.DataPointVM(tVal[i], rVal[i]));
}
mdlres.RESULTs = points.ToList();
}
return mdlres;
I want to get all listkey with the details.