they both have coil ,and depend on the magnetic field when current passes through,
the difference (also in motors) is the way you make the coil,
as the AC continuously changes,but for DC is same
...