private async void MBtnSignUp_Click(object sender, EventArgs e) { if (mtxtEmail.Text == "") { mtxtEmail.Error = "Email address required"; } else if (mtxtPassword.Text == "") { mtxtPassword.Error = "Password required"; } if (mtxtPassword.Text == mtxtConfirmPassword.Text) { register = new Register(mtxtEmail.Text, mtxtPassword.Text, mtxtPassword.Text); //Account activation api to implement HttpClient client = new HttpClient(); KululaUrl url = new KululaUrl(); var uri = new Uri(url.rootUrl + url.UrlRegisterPost); client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json")); HttpResponseMessage response; var json = JsonConvert.SerializeObject(register); var content = new StringContent(json, Encoding.UTF8, "application/json"); response = await client.PostAsync(uri, content); if (response.StatusCode == System.Net.HttpStatusCode.OK) { transaction = FragmentManager.BeginTransaction(); AccActivation userDetailsDialog = new AccActivation(); userDetailsDialog.SetStyle(DialogFragmentStyle.NoTitle, 0); userDetailsDialog.Show(transaction, "Account Activation"); Clear(); Dismiss(); } else { mTxtError.Text = "Server error! " + response.StatusCode; } } else { mtxtConfirmPassword.Error = "Confirm password do not match password"; } }
private async void MBtnSignupDetails_Click(object sender, EventArgs e) { if (mTxtPhone.Text == null) { mTxtPhone.Error = "Phone number required"; } else if (mTxtAddress.Text == null) { mTxtAddress.Error = "Physical address required"; } else if (mTxtFname.Text == null) { mTxtFname.Error = "First name required"; } else if (mTxtLname.Text == null) { mTxtLname.Error = "Last name required"; } else if (mTxtId.Text == null) { mTxtId.Error = "Identity number required"; } Client userDetails = new Client { Address = mTxtAddress.Text, FirstName = mTxtFname.Text, LastName = mTxtLname.Text, IdNumber = mTxtId.Text, PhoneNo = mTxtPhone.Text, }; if (mRadio_male.Selected == true) { userDetails.Gender = "Male"; } else { userDetails.Gender = "Female"; } HttpClient client = new HttpClient(); KululaUrl url = new KululaUrl(); var uri = new Uri(url.rootUrl + url.UrlClientDetailsPost); client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json")); HttpResponseMessage response; var json = JsonConvert.SerializeObject(userDetails); var content = new StringContent(json, Encoding.UTF8, "application/json"); response = await client.PostAsync(uri, content); if (response.StatusCode == System.Net.HttpStatusCode.OK) { //StartActivity(typeof(User)); var activity2 = new Intent(this.Activity, typeof(User)); activity2.PutExtra("FirstName", mTxtFname.Text); StartActivity(activity2); InputClear(); } else { mTxtAddress.Text = "Server error! " + response.StatusCode; } }