I have a database where the columns are int datatypes. The column int-values corresponds to seconds since 1980-01-01 (MS-DOS timestamp).
Is it possible to convert these int-values using Entity Framework? If not that else to do? The conversion needs to be efficient.
I have tried the following SQL in my controller but I receive a JSON error from the client (Fiddler output: JSON=-1):
public JsonResult GetData()
{
var model = entities.Database.ExecuteSqlCommand(
@"SELECT TOP 10
dateadd(S, [timestamp], '1980-01-01') [datetime_conv],
[value]
FROM [Data_2696415_20] AS tabel");
return Json(model, JsonRequestBehavior.AllowGet);
}
I am using Entity Framework version 6.1.