Both the Republican and the Democratic parties scored key victories on Tuesday that they will try to build on as they shift the focus to state races.