public HttpResponseMessage<Contact> Post(HttpRequestMessage<Contact> request) { var pero = request.Content.ReadAsAsync(typeof(Contact)).Result;
Why are you not using the mappers and just accepting a parameter of type Contact in your method? The framework will do the mapping for you.
And if you need to access other properties in the request objects, you have that in the ApiController base class (just write this.Request in your method).
SiggiGG
Member
265 Points
105 Posts
Re: How to correctly use PostAsync and PutAsync?
Feb 27, 2012 08:38 AM|LINK
Why are you not using the mappers and just accepting a parameter of type Contact in your method? The framework will do the mapping for you.
And if you need to access other properties in the request objects, you have that in the ApiController base class (just write this.Request in your method).
logic_rabbit
Member
15 Points
8 Posts
Re: How to correctly use PostAsync and PutAsync?
Feb 27, 2012 08:43 AM|LINK
Thanks guys. I will try your approuch.
I have used this approuch becouse this is migrated project from WCF Web Api where I have used that way.
UPDATE : Your approuch works fine. Thanks