Is the working of diesel and electric locomotive same?

Locomotive engines are the most important thing in railways. Normally there are 3 types of locomotives. They are steam, diesel and electric locomotive engines. Diesel and electric engines are mostly used by railways. Without diesel or electric power, engines don’t work. But do you know, the working principle of both the locomotive engines is same?