In the view I want to get the json data like this:
[{"name":"NewWork",
"data":[{"\/Date(1398787200000)\/",196},
{"\/Date(1398009600000)\/",62},
{"\/Date(1397836800000)\/",65}]
},
{"name":"BeiJing",
"data":[{"\/Date(1398787200000)\/",106},
{"\/Date(1398700800000)\/",100},
{"\/Date(1398441600000)\/",61},
{"\/Date(1398355200000)\/",86}]
}]
So in the controller I define the class like these,and return `List<viewmodelcitydata>` but the return data format is not what I want.How can I change the controller ViewModelCityData?And the other question,in the view my json `data` need to be order by `X`,if I sort them in the controller,why do they not order in the view?I have to sort them again in the view.
public class ViewModelCityData
{
public string name { get; set; }
public List<Point> data { get; set; }
}
public class Point
{
public DateTime X { get; set; }
public int Y { get; set; }
}
[{"name":"NewWork",
"data":[{"X":"\/Date(1398787200000)\/","Y":196},
{"X":"\/Date(1398009600000)\/","Y":62},
{"X":"\/Date(1397836800000)\/","Y":65}]
},
{"name":"BeiJing",
"data":[{"X":"\/Date(1398787200000)\/","Y":106},
{"X":"\/Date(1398700800000)\/","Y":100},
{"X":"\/Date(1398441600000)\/","Y":61},
{"X":"\/Date(1398355200000)\/","Y":86}]}]