private IEnumerable <AutocompleteModel> GetAllSectionAutocompleteModelsWith(string searchString, int sessionId) { var session = _genericRepository.Get <Session>(s => s.SessionIdentity == sessionId); var query = new SectionsBySectionNameAndSessionQuery(searchString, session); var sections = _genericRepository.GetAll(query).ToList(); var autocompleteModels = sections.Select(section => _sectionToAutocompleteModelMapper.Build(section)).ToList(); if (autocompleteModels.IsNullOrEmpty()) { autocompleteModels.Add(new AutocompleteModel { LabelName = "No results" }); } return(autocompleteModels); }
private IEnumerable<AutocompleteModel> GetAllSectionAutocompleteModelsWith(string searchString, int sessionId) { var session = _genericRepository.Get<Session>(s => s.SessionIdentity == sessionId); var query = new SectionsBySectionNameAndSessionQuery(searchString, session); var sections = _genericRepository.GetAll(query).ToList(); var autocompleteModels = sections.Select(section => _sectionToAutocompleteModelMapper.Build(section)).ToList(); if (autocompleteModels.IsNullOrEmpty()) { autocompleteModels.Add(new AutocompleteModel{LabelName = "No results"}); } return autocompleteModels; }