public string Create(User user) { if (userGateway.Create(user) > 0) { return "Created Successfully!"; } else { return "Could Not Created!"; } }
protected void addUserButton_Click(object sender, EventArgs e) { User user = new User(); user.FullName = fullNameTextBox.Text; user.EmailAddress = emailAddressTextBox.Text; user.ContactNumber = contactNumberTextBox.Text; user.UserName = userNameTextBox.Text; user.Password = passwordTextBox.Text; message.InnerHtml = userManager.Create(user); }
public int Create(User user) { SqlConnection connection = new SqlConnection(databaseConString); string query = "INSERT INTO tbl_user VALUES('" + user.FullName + "','" + user.EmailAddress + "','" + user.ContactNumber + "','" + user.UserName + "','" + user.Password + "')"; SqlCommand command = new SqlCommand(query, connection); connection.Open(); int rowAffected = command.ExecuteNonQuery(); connection.Close(); return rowAffected; }
public User GetUserInformation(string loginUserName, string loginPassword) { SqlConnection connection = new SqlConnection(databaseConString); string query = "SELECT * FROM tbl_user"; SqlCommand command = new SqlCommand(query, connection); connection.Open(); SqlDataReader reader = command.ExecuteReader(); User user = new User(); while (reader.Read()) { user.UserName = reader["username"].ToString(); user.Password = reader["password"].ToString(); } reader.Close(); connection.Close(); return user; }