public ActionResult Index() { IEnumerable <Person> people; string filter = (string)this.Session["FilterString"]; if (filter != null && filter != "") { bool caseSensitive = (bool)this.Session["FilterCaseSensitive"]; people = PersonList.Filter(filter, caseSensitive, PersonList.people); } else { people = from person in PersonList.people select person; } if (this.Session["SortByName"] != null) { people = PersonList.Sort((bool)this.Session["SortByName"], people); } return(View(people)); }