I\'m still learning web API, so pardon me if my question sounds stupid.
I have this in my StudentController
:
public HttpResponseMessage
Just to add my history to this thread. My model:
public class UserProfileResource
{
public Guid Id { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public string Phone { get; set; }
public UserProfileResource()
{
}
}
The above object couldn't be serialized in my API Controller and would always return null. The issue was with Id of type Guid: everytime I passed empty string as an Id (being naive that it will automatically be converted to Guid.Empty
) from my frontend I received null object as [FromBody]
paramether.
Solution was either to
Guid
value Guid
to String