public async Task <ActionResult <IEnumerable <ArmorProperty> > > Get(Language language = Language.en)
        {
            List <ArmorProperty> armorProperties;

            try
            {
                armorProperties = (await _tableStorage.GetAllAsync <ArmorProperty>($"armorProperties{language}")).ToList();
            }
            catch (StorageException e)
            {
                if (e.Message == "Not Found")
                {
                    armorProperties = (await _tableStorage.GetAllAsync <ArmorProperty>($"armorProperties{Language.en}")).ToList();
                    return(Ok(armorProperties));
                }
                throw;
            }
            return(Ok(armorProperties));
        }
Beispiel #2
0
        public async Task <ActionResult <IEnumerable <Power> > > Get(Language language = Language.en)
        {
            List <Power> powers;

            try
            {
                powers = (await _tableStorage.GetAllAsync <Power>($"powers{language}")).ToList();
            }
            catch (StorageException e)
            {
                if (e.Message == "Not Found")
                {
                    powers = (await _tableStorage.GetAllAsync <Power>($"powers{Language.en}")).ToList();
                    return(Ok(powers));
                }
                throw;
            }
            return(Ok(powers));
        }
        public async Task <ActionResult <IEnumerable <ReferenceTable> > > Get(Language language = Language.en)
        {
            List <ReferenceTable> referenceTables;

            try
            {
                referenceTables = (await _tableStorage.GetAllAsync <ReferenceTable>($"referenceTables{language}")).ToList();
            }
            catch (StorageException e)
            {
                if (e.Message == "Not Found")
                {
                    referenceTables = (await _tableStorage.GetAllAsync <ReferenceTable>($"referenceTables{Language.en}")).ToList();
                    return(Ok(referenceTables));
                }
                throw;
            }
            return(Ok(referenceTables));
        }
        public async Task <ActionResult <IEnumerable <StarshipVenture> > > Get(Language language = Language.en)
        {
            List <StarshipVenture> starshipVentures;

            try
            {
                starshipVentures = (await _tableStorage.GetAllAsync <StarshipVenture>($"starshipVentures{language}")).ToList();
            }
            catch (StorageException e)
            {
                if (e.Message == "Not Found")
                {
                    starshipVentures = (await _tableStorage.GetAllAsync <StarshipVenture>($"starshipVentures{Language.en}")).ToList();
                    return(Ok(starshipVentures));
                }
                throw;
            }
            return(Ok(starshipVentures));
        }
Beispiel #5
0
        public async Task Upload()
        {
            var existingSearchTerms = (await _tableStorage.GetAllAsync <GlobalSearchTerm>("searchTerms")).ToList();

            var i = 1;

            Parallel.ForEach(existingSearchTerms, new ParallelOptions {
                MaxDegreeOfParallelism = Environment.ProcessorCount
            }, async existingSearchTerm =>
            {
                await _tableStorage.DeleteAsync("searchTerms", existingSearchTerm);
                Console.WriteLine($"Deleted {i} of {existingSearchTerms.Count} existing search terms.");
                i++;
            });

            foreach (var globalSearchTerm in _globalSearchTermRepository.SearchTerms)
            {
                globalSearchTerm.LanguageEnum = _localization.Language;
            }

            await _tableStorage.AddBatchAsync <GlobalSearchTerm>("searchTerms",
                                                                 _globalSearchTermRepository.SearchTerms.Where(s =>
                                                                                                               s.PartitionKey == ContentType.ExpandedContent.ToString()),
                                                                 new BatchOperationOptions { BatchInsertMethod = BatchInsertMethod.Insert });

            await _tableStorage.AddBatchAsync <GlobalSearchTerm>("searchTerms",
                                                                 _globalSearchTermRepository.SearchTerms.Where(s =>
                                                                                                               s.PartitionKey == ContentType.Core.ToString()),
                                                                 new BatchOperationOptions { BatchInsertMethod = BatchInsertMethod.Insert });

            var index = await _searchIndexClient.GetIndexAsync("searchterms-index");

            await _searchIndexClient.DeleteIndexAsync("searchterms-index");

            await _searchIndexClient.CreateIndexAsync(index);

            var oldIndexer = await _searchIndexerClient.GetIndexerAsync("searchterms-indexer");

            await _searchIndexerClient.DeleteIndexerAsync(oldIndexer);

            await _searchIndexerClient.CreateIndexerAsync(oldIndexer);

            await _searchIndexerClient.RunIndexerAsync("searchterms-indexer");
        }
Beispiel #6
0
        public async Task <ActionResult <IEnumerable <SkillLU> > > Get()
        {
            var skillLUs = await _tableStorage.GetAllAsync <SkillLU>("skillsLU");

            return(Ok(skillLUs));
        }
Beispiel #7
0
        public async Task <ActionResult <IEnumerable <CharacterAdvancementLU> > > Get()
        {
            var characterAdvancementLUs = await _tableStorage.GetAllAsync <CharacterAdvancementLU>("characterAdvancementLU");

            return(Ok(characterAdvancementLUs));
        }
Beispiel #8
0
        public async Task <ActionResult <IEnumerable <ConditionLU> > > Get()
        {
            var conditionLus = await _tableStorage.GetAllAsync <ConditionLU>("conditionsLU");

            return(Ok(conditionLus));
        }