コード例 #1
0
        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);
        }
コード例 #2
0
        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;
        }