私は、定義されたprとしてpaginationを使用している.Net Core MVCプロジェクトを持っています。マイクロソフトの文書綿棒/ UNIXタイムスタンプ(ms)から綿棒ビューのDatetimeへ
私のデータベースのタイムスタンプはEpochであるため、タイムスタンプをdatetimeオブジェクトに変換する必要があります。タイムスタンプは、私のRazor Viewのテーブルに使用されているためです。
public partial class Tripmetadata
{
public Tripmetadata()
{
}
[Key]
public int Tripid { get; set; }
[Display(Name = "Start Timestamp")]
public long? Starttimestamp { get; set; }
[Display(Name = "End Timestamp")]
public long? Endtimestamp { get; set; }
public long? Duration { get; set; }
[Display(Name = "Average Speed")]
public decimal? AvgSpeed { get; set; }
public decimal? Distance { get; set; }
}
は、私が以前にこのの世話をするためにViewModelにに使用されるが、PRとして、次のように
@model PaginatedList<MSPFrontend.Tripmetadata>
<div class="table-responsive">
<table class="table table-bordered table-condensed table-hover table-striped">
<thead>
<tr>
<th>Trip Id</th>
<th>Start Time</th>
<th>End Time</th>
<th>Duration</th>
<th>Avg Speed</th>
<th>Distance</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model)
{
<tr class="trip" data-id="@item.Tripid" data-url="@Url.Action("TripMapping", "Trip")">
<td>@item.Tripid</td>
<td>@item.Starttimestamp</td>
<td>@item.Endtimestamp</td>
<td>@item.Duration</td>
<td>@item.AvgSpeed knots</td>
<td>@item.Distance km</td>
</tr>
}
</tbody>
</table>
</div>
私のモデルが見えます:表には、次のように作成されます。 Microsoft Paginationドキュメントでは、ページネーションをスクロールするときにデータを要求するため、モデルを使用する必要があります。
私はそれのような何かを行うことは可能だろうと思った:
<td>@new DateTime(1970, 1, 1, 0, 0, 0).AddMilliseconds(@Convert.ToDouble(@item.Starttimestamp))</td>
しかし、私はしようとしたとき、私は、次を得る:
jquery.js:9566 GET http://localhost:1048/Trip/TripTable 500 (Internal Server Error)