Я переношу старое приложение, и мне нужно, чтобы определенный метод api 2 в Интернете возвращал дату следующим образом: /Date(46546)/
, а не в формате ISO 8601: 2016-10-31T07:22:57.1153868-05:00
Как заставить метод Web Api возвращать дату с таким форматом:/Date (46546)/
Мой метод Web 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 });
}
}