public void Switch(int id) { Oven Oven = this.GetOvenById(id); if (Oven.IsOn) { Oven.Off(); } else { Oven.On(); } this.Unit.SaveChanges(); }