public ActionResult Switch(int id) { IDictionary <int, Applience> applienceDictionary = (SortedDictionary <int, Applience>)Session["Apps"]; ISwitchable app = applienceDictionary[id]; app.OnOff(); return(RedirectToAction("Index")); }