Forum General

HttpClient PutAsync with parameters

RajzerRajzer Member ✭✭
edited March 2020 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:

        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.

Sign In or Register to comment.