Posting to external web api
Hello when trying to post to my web api I get no values passed out when using the Create new Rest Service
Here is the post value:
{"ID":,"Username":"jason","Password":"jason","UserDetailID":1,"DateOfBirth":"1971-11-09T00:00:00","Email":"a href="mailto:jason@jason.com" rel="nofollow"jason@jason.com/a"}
And the URL i am trying to post to is : http://www.fangatez.com/api/User
Here is me trying to do this in JQuery:
I tried it with array brackets and without.
Here is my api Post Method call:
public User Post([FromBody]User user)
{
using (FangateEntities context = new FangateEntities())
{
User u = new User();
u.Username = user.Username;
u.Password = user.Password;
u.Email = user.Email;
u.DateOfBirth = user.DateOfBirth;
u.UserDetailID = user.UserDetailID;
context.Users.Add(u);
context.SaveChanges();
return u;
}
}
Am I doing something wrong? It posts but with no data the User object is null when it gets to my Method.