public IActionResult Index(string activeConf = "all", string activeDiv = "all") { var session = new CustomerSession(HttpContext.Session); session.SetActiveConf(activeConf); session.SetActiveDiv(activeDiv); var model = new Customer { Name = activeConf, Email = activeDiv, Conferences = context.Conference, Divisions = context.Divisions }; IQueryable <Registration> query = context.Registrations; if (activeConf != "all") { query = query.Where( t => t.Conference == activeConf.ToLower()); } if (activeDiv != "all") { query = query.Where( t => t.Division == activeDiv.ToLower()); } model.Registrations = (System.Collections.Generic.List <Customer>)query; return(View(model)); }