How can I add the following data on the table into a list called Vehicles?
public class criterias
{
public double values { get; set; }
publi
it seems in your table the VehicleId is of type string. Make sure your VehicleId property in Vehicle class also matches the same.
You can use the collection initializers to set the values of child objects like this way:
var data = new vehicles()
{
vehID = 1,
vehDescription = "Average Car",
vehValCriteria = new List()
{
new stepsList()
{
steps = "Move car",
stepChannelsCriteria = new List()
{
new movChannels()
{
name = "engage firstgear",
criteria = new List()
{
new criterias()
{
values = 1,
time = 1
},
}
},
new movChannels()
{
name = "reach 10kph",
criteria = new List()
{
new criterias()
{
values = 10,
time = 5
},
}
},
new movChannels()
{
name = "maintain 10kph",
criteria = new List()
{
new criterias()
{
values = 10,
time = 12
},
}
}
}
},
new stepsList()
{
steps = "stop car",
stepChannelsCriteria = new List()
{
new movChannels()
{
name = "reach okph",
criteria = new List()
{
new criterias()
{
values = 10,
time = 4
},
}
},
new movChannels()
{
name = "put in neutral",
criteria = new List()
{
new criterias()
{
values = 0,
time = 1
},
}
},
new movChannels()
{
name = "turn off vehicle",
criteria = new List()
{
new criterias()
{
values = 0,
time = 0
},
}
}
}
}
}
};