我正在学习一些.NET和using (DocX doc = DocX.Create(fileName))
{
doc.PageLayout.Orientation = Orientation.Landscape;
var table = doc.AddTable(12, 2);
doc.InsertTable(table);
doc.InsertSectionPageBreak();
}
,在这种情况下需要一些帮助来弄清楚如何处理handlebars
日期解析:
JSON
public JsonResult stats()
{
IQueryable<EnrollmentDateGroup> data = from student in db.Students
group student by student.EnrollmentDate into dateGroup
select new EnrollmentDateGroup()
{
EnrollmentDate = dateGroup.Key,
StudentCount = dateGroup.Count()
};
return Json(data.ToList());
}
<script id="mytemplate" type="text/x-handlebars-template">
<h3 style="margin-top:20px">Student Body Statistics</h3>
<table>
<tr>
<th>Enrollment Date</th>
<th>Students</th>
</tr>
{{#each this}}
<tr>
<td>{{{EnrollmentDate}}}</td>
<td>{{{StudentCount}}}</td>
</tr>
{{/each}}
</table>
</script>
我的 <script type="text/javascript">
(function () {
var templateHtml = $("#mytemplate").html();
var sourceHtml = Handlebars.compile(templateHtml);
$.post("@Url.Action("stats")", "", function (data) {
$('#stu').html(sourceHtml(data));
console.log(data);
}, "json");
})();
</script>
结果数据是DB
如何将此日期解析为实际日期?