简体   繁体   中英

Xamarin.forms webservice to azure database

I am a newbie in Xamarin and I am looking for a way to send information to the azure database with Xamarin.forms, I am using webservice.

What I have done:

1-I have already created my azure database online

2-I have make the code to send information

Problem:

1-I do not know what I have to put in client.PostAsync to sending my information (email ,password, confirmpassword)

Here is the code :

public class ApiServices
    {
        public async Task <bool> RegisterAsync(string email, string password, string confirmPassword)
        {
            var client = new HttpClient();

            var model = new RegisterBindingModel
            {
                Email=email,
                Password=password,
                ConfirmPassword= confirmPassword

            };

            // to send my information
            var json = JsonConvert.SerializeObject(model);
            HttpContent content = new StringContent(json);
            content.Headers.ContentType = new MediaTypeHeaderValue("application/json");


              // what do I need to put in PostAsync?
            var response= await client.PostAsync("",content);


            return response.IsSuccessStatusCode;
        }
    }

Thanks in advance . if you have better solution and somme information to know , I will take it.

PostAsync的第一个参数必须是Service Uri,例如http://mywebservice.com/api/user

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM