public string Undo() { switch (_prevSpeed) { case Fan.High: return(_fan.SetHigh()); case Fan.Medium: return(_fan.SetMedium()); case Fan.Low: return(_fan.SetLow()); case Fan.Off: return(_fan.SetOff()); default: return("fan set speed error"); } }
public string Undo() { if (_prevSpeed.Equals(Fan.High)) { _fan.SetHigh(); } if (_prevSpeed.Equals(Fan.Medium)) { _fan.SetMedium(); } if (_prevSpeed.Equals(Fan.Low)) { _fan.SetLow(); } if (_prevSpeed.Equals(Fan.Off)) { _fan.SetOff(); } return("fan set speed error"); }