I need to return a field that is of type bool
:
public List<TB_USUARIO> ListarTodos()
{
var strQuery = "select * from tb_usuario";
using (contexto = new Contexto())
{
var retornoDataReader = contexto.ExecutaComandoComRetorno(strQuery);
return TransformaReaderEmListaObjetos(retornoDataReader);
}
}
private List<TB_USUARIO> TransformaReaderEmListaObjetos(SqlDataReader reader)
{
var retornando = new List<TB_USUARIO>();
while (reader.Read())
{
TB_USUARIO tabela = new TB_USUARIO()
{
IDUSUARIO = reader["IDUSUARIO"] == DBNull.Value ? 0 : Convert.ToInt32(reader["IDUSUARIO"]),
NOME = reader["NOME"] == DBNull.Value ? string.Empty : reader["NOME"].ToString(),
LOGIN = reader["LOGIN"] == DBNull.Value ? string.Empty : reader["LOGIN"].ToString(),
SENHA = reader["SENHA"] == DBNull.Value ? string.Empty : reader["SENHA"].ToString(),
ADMINISTRADOR = (bool)reader["ADMINISTRADOR"] //este campo
};
retornando.Add(tabela);
}
reader.Close();
return retornando;
}