public IActionResult Index(string searchString) { IEnumerable <Story> stories = new List <Story>(); var cachedStories = _cache.Get <List <Story> >("storiesKey"); if (cachedStories == null) { stories = _service.GetStories().Result; AddStoriesToCache(stories); } else { stories = cachedStories; } if (!String.IsNullOrEmpty(searchString)) { stories = stories.Where(s => s.Title.Contains(searchString)); } return(View(stories)); }