private async void RegisterBtn_Clicked(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtFirstName.Text)) { errorLbl.Text = "Please enter your first name."; } else if (string.IsNullOrEmpty(txtLastName.Text)) { errorLbl.Text = "Please enter your last name."; } else if (string.IsNullOrEmpty(txtEmail.Text)) { errorLbl.Text = "Please enter your email address."; } else if (string.IsNullOrEmpty(txtPhone.Text)) { errorLbl.Text = "Please enter your phone number."; } else if (string.IsNullOrEmpty(txtUsername.Text)) { errorLbl.Text = "Please enter a username."; } else if (string.IsNullOrEmpty(txtPassword.Text)) { errorLbl.Text = "Please enter a password."; } else { Users user = new Users { firstName = txtFirstName.Text, lastName = txtLastName.Text, email = txtEmail.Text, phone = txtPhone.Text, username = txtUsername.Text, password = txtPassword.Text }; userDAL dal = new userDAL(); dal.AddUser(user); await Navigation.PushAsync(new HomePage(txtUsername.Text, txtPassword.Text)); } }
protected void btnAddUser_Click(object sender, EventArgs e) { //Getting Values from UI user.full_name = txtFullName.Text; user.username = txtUsername.Text; user.email = txtEmail.Text; user.password = txtPassword.Text; user.addeddate = DateTime.Now; //Object for DAL userDAL dal = new userDAL(); bool succes = dal.AddUser(user); if (succes == true) { lblResult.Text = "User successfully added."; Clear(); } else { lblResult.Text = "Failed to add user"; } }