Although he was not on the ballot, the elections were effectively a nationwide referendum on Trump.