C# 使用JSON对象请求WebApi DateTime Post?
post DateTime的json字符串是什么样子的?制作一个对象,并将其包装成这样:C# 使用JSON对象请求WebApi DateTime Post?,c#,datetime,asp.net-web-api,C#,Datetime,Asp.net Web Api,post DateTime的json字符串是什么样子的?制作一个对象,并将其包装成这样: public object postDate(DateTime start) { //Save the DateTime to sql Server //return success code or object } 然后将其发布到操作: Public class SampleModel { Public DateTime Start {get; s
public object postDate(DateTime start)
{
//Save the DateTime to sql Server
//return success code or object
}
然后将其发布到操作:
Public class SampleModel
{
Public DateTime Start {get; set;}
}
JSON必须如下所示:
public object postDate(SampleModel sampleModel)
{
// sampleModel.Start
//Save the DateTime to sql Server
//return success code or object
}
读一下发布DateTime时json字符串是什么样子的?我在回答的末尾放了一个json示例。谢谢,现在一切都好了:{“StartTime”:“2017-05-17 14:04:58”}顺便说一句,这个也可以用:)
{
"Start":"2017-05-11T09:18:54.092Z"
}