The president said the network was “spending far too much time putting on” Democrats ahead of the upcoming midterm elections.