예제 #1
0
        public ActionResult Index()
        {
            var model = new BestBetsViewModel(CurrentLanguage);

            foreach (KeyValuePair <string, string> language in Languages)
            {
                var name = language.Value;
                name = String.Concat(name.Substring(0, 1).ToUpper(), name.Substring(1));
                var indexName = SwapLanguage(CurrentIndex, language.Key);

                model.BestBetsByLanguage.Add(new BestBetsByLanguage
                {
                    LanguageName = name,
                    LanguageId   = language.Key,
                    Indices      = UniqueIndices,
                    BestBets     = GetBestBetsForLanguage(language.Key, indexName)
                });
            }

            var config = ElasticSearchSection.GetConfiguration();

            foreach (ContentSelectorConfiguration entry in config.ContentSelector)
            {
                model.SelectorTypes.Add(entry.Type.ToLower());
                model.SelectorRoots.Add(new ContentReference(entry.Id, entry.Provider));
            }

            var currentType = config.IndicesParsed.FirstOrDefault(i => CurrentIndex.StartsWith(i.Name, StringComparison.InvariantCultureIgnoreCase))?.Type;

            ViewBag.TypeName = !String.IsNullOrEmpty(currentType) ? Type.GetType(currentType)?.AssemblyQualifiedName : typeof(IndexItem).AssemblyQualifiedName;

            return(View("~/Views/ElasticSearchAdmin/BestBets/Index.cshtml", model));
        }
예제 #2
0
        protected string GetTypeName()
        {
            var config = ElasticSearchSection.GetConfiguration();

            var currentType = config.IndicesParsed.FirstOrDefault(i => CurrentIndex.StartsWith(i.Name, StringComparison.InvariantCultureIgnoreCase))?.Type;

            return(!String.IsNullOrEmpty(currentType)
                ? Type.GetType(currentType)?.AssemblyQualifiedName
                : typeof(IndexItem).AssemblyQualifiedName);
        }