Bohemians stretched their unbeaten run to seven matches after a 2-1 win at home to bottom side Cork City.