private void btnSave_Click(object sender, RoutedEventArgs e) { usermodel = new UserViewModel(); string name = txtName.Text; string surname = txtSurname.Text; int age = Convert.ToInt32(txtAge.Text); string idNumber = txtId.Text; string homeLanguage = txtHomeLan.Text; string contactNum = txtNum.Text; string emailAddress = txtEmail.Text; string username = txtUsernames.Text; string password = txtPassword.Text; try { usermodel.addUser(name,surname,age,idNumber,homeLanguage,contactNum,emailAddress,username,password); } catch(Exception exc) { MessageBox(exc.Message); } MessageBox("You are successful registered"); }
private void btnRegister_Click(object sender, RoutedEventArgs e) { user = new UserViewModel(); string username = txtUserName.Text; string password = txtPassword.Text; string confirm = txtConfirm.Text; if (!username.Equals("") && !password.Equals("")) { if (password.Equals(confirm)) { user.addUser(username, password); messageBox("account has been created"); } else { messageBox("Passwords do not match"); } txtPassword.Text = ""; txtConfirm.Text = ""; } else { messageBox("Sorry!!!!These fields cannot be left blank"); } }