public ActionResult Index(bool sorting) { using (IDal dal = new Dal()) { // Set data within the context in order to indicate whether list should [not be sorted/ascending/descending] depending on demand dal.UpdateContext(sorting); bool?listAscSorting = dal.GetContext().ListAscSorting; // Retrieve all performances, sort them as required, attach them to context and display the view List <Performance> performances = dal.GetAllPerformances(listAscSorting); dal.AddPerformancesToContext(performances); return(View(performances)); } }