古いアプリケーションを移行していて、特定のWeb API 2メソッドが次のような日付を返す必要があります。/Date(46546)/
ISO 8601形式で:2016-10-31T07:22:57.1153868-05:00
Web Apiメソッドに次のような形式で日付を返すようにする方法/ Date(46546)/
マイウェブAPIメソッドは、次のようになります。
[Route("GetListData/{jtStartIndex:int=0}/{jtPageSize:int=0}/{jtSorting?}")]
[HttpPost]
public HttpResponseMessage GetListData(int jtStartIndex, int jtPageSize, string jtSorting)
{
try
{
var dataList = DataContainer.Instance.Data;
//HERE dataList is a collection of a custom model, a model that have properties of datetime type.
return this.Request.CreateResponse(HttpStatusCode.OK,
new { Result = "OK", Records = dataList, TotalRecordCount = dataList.Count });
}
catch (Exception ex)
{
return this.Request.CreateResponse(
HttpStatusCode.InternalServerError,
new { Result = "ERROR", Message = ex.Message });
}
}