Send JSON date to WCF service
Posted
by
user1394569
on Stack Overflow
See other posts from Stack Overflow
or by user1394569
Published on 2012-06-19T17:05:20Z
Indexed on
2012/06/19
21:16 UTC
Read the original article
Hit count: 137
I want to post json object to my WCF service
My only problem is his date property. I get the date from an jquery datepicker and i want to get it in my service as c# datetime.
My service:
namespace Employee
{
[ServiceContract]
public interface IService1
{
[OperationContract]
[WebInvoke(Method = "POST",
RequestFormat = WebMessageFormat.Json,
ResponseFormat = WebMessageFormat.Json,
BodyStyle = WebMessageBodyStyle.Wrapped)]
bool UpdateEmployee(Employee Employee);
}
}
And this is Employee:
[DataContract]
public class Employee
{
[DataMember]
public string Name { get; set; }
[DataMember]
public string Department { get; set; }
[DataMember]
public int Salary { get; set; }
[DataMember]
public DateTime Hired { get; set; }
}
All the other properties work fine. I just need to convert my date string to json date.
© Stack Overflow or respective owner