Negative differential resistance and switching effect in ternary magnetic semiconductors