State assemblyman goes from a political unknown to the next mayor of New York City.