Reputation: 522
I'm creating a web service REST by using WCF, framework 3.5 (I'm using this version because the client's enviroment can't support later versions). So, I have tested its GET Methods and it's working properly, but when it comes to using POST Methods and I'm getting trouble with some types of parameters, more specific with DATETIME, To give you an idea look how my class is:
[DataContract]
public class OcorrenciaEventoPf
{
[DataMember]
public int Id { get; set; }
[DataMember]
public int PessoaFisicaId { get; set; }
[DataMember]
public string DataAssociacao { get; set; }
[DataMember]
public string Operador { get; set; }
[DataMember]
public char Operacao { get; set; }
[DataMember]
public bool Retorno { get; set; }
[DataMember]
public int Controle { get; set; }
[DataMember]
public SubModel.PessoaFisica PessoaFisica { get; set; }
}
Look at the field "DataAssociacao" it's string right now, and if I send this json :
[ {
"Id" : 12 ,
"PessoaFisicaId" : 13,
"DataAssociacao" : "2011-06-02T12:24:34",
"Operador" : "Joab",
"Operacao" : "A",
"Retorno" : false,
"Controle" : 1,
"PessoaFisica" : {}
}
]
It's gonna work, but when I change "DataAssociacao" type into DateTime , if I send the same json it won't work, even if I don't send anything to this field
Upvotes: 1
Views: 2789
Reputation: 726
So it's a format problem please follow this reponse to solve you datetime format How to handle json DateTime returned from WCF Data Services (OData)
Upvotes: 1