[英]Xamarin.forms webservice to azure database
我是Xamarin的新手,我正在寻找一种使用Xamarin.forms将信息发送到Azure数据库的方法,我正在使用Web服务。
我做了什么:
1-我已经在线创建了Azure数据库
2-我已经制作了发送信息的代码
问题:
1-我不知道我要在client.PostAsync中放入什么来发送我的信息(电子邮件,密码,确认密码)
这是代码:
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;
}
}
提前致谢 。 如果您有更好的解决方案并希望获得大量信息,我会接受。
PostAsync的第一个参数必须是Service Uri,例如http://mywebservice.com/api/user
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.