public int?GetIDOfMatchingDonor(DonorQuery donorQuery) { int?id = null; if (OpenConnection()) { NpgsqlCommand command = new NpgsqlCommand(); command.Connection = connection; command.CommandType = System.Data.CommandType.Text; command.CommandText = "SELECT id FROM donor WHERE first_name = @first_name AND last_name = @last_name;"; var firstNameParam = new NpgsqlParameter("@first_name", donorQuery.FirstName); firstNameParam.DbType = System.Data.DbType.String; command.Parameters.Add(firstNameParam); var lastNameParam = new NpgsqlParameter("@last_name", donorQuery.LastName); lastNameParam.DbType = System.Data.DbType.String; command.Parameters.Add(lastNameParam); NpgsqlDataReader dataReader = command.ExecuteReader(); while (dataReader.Read()) { id = dataReader.GetInt32(0); } CloseConnection(); } return(id); }
public int?GetIDOfMatchingDonor(DonorQuery donorQuery2) { return(databaseBridge.GetIDOfMatchingDonor(donorQuery2)); }