Forum General

HttpClient PutAsync with parameters

RajzerRajzer Member ✭✭
edited March 31 in General

Hello guys i'm using Xamarin.Forms app which communicate with Web Api 2. I have a PutAsync call but i dont know how to make it.

This is my Action in the Api:

[System.Web.Http.HttpPut]
        public IHttpActionResult EditFirm(int user_id, int firm_id)

And in Xamarin.Forms request something trying like this but doesn't work:

                                var jsonString = "{\"user_id\":user,\"firm_id\":firm}";
                                var httpContent = new StringContent(jsonString, Encoding.UTF8, "application/json");
                                await client.PutAsync(@"api/Fin/EditFirm",httpContent);

How to make it ? Maybe @"api/Fin/EditFirm?user_id= " + user + "&firm_id=" + firm-> this work for getasync but here need a content.

Tagged:
Sign In or Register to comment.