示例#1
0
        public async Task <IActionResult> RemoveCurrentProviders()
        {
            try
            {
                await _searchRepository.DeleteIndex();
            }
            catch (Exception ex)
            {
                _logger.Error(ex, "Failed to delete providers index");

                return(new InternalServerErrorResult(ex.Message));
            }

            bool cachedSummaryCountExists = await _cacheProvider.KeyExists <string>(CacheKeys.AllProviderSummaryCount);

            if (cachedSummaryCountExists)
            {
                await _cacheProvider.KeyDeleteAsync <string>(CacheKeys.AllProviderSummaryCount);
            }

            bool cachedSummariesExists = await _cacheProvider.KeyExists <ProviderSummary>(CacheKeys.AllProviderSummaries);

            if (cachedSummariesExists)
            {
                await _cacheProvider.RemoveAsync <ProviderSummary>(CacheKeys.AllProviderSummaries);
            }

            await _cacheProvider.RemoveByPatternAsync("scoped-provider-summaries:*");

            return(new NoContentResult());
        }
        public async Task <IActionResult> DeleteIndex(string indexName)
        {
            _searchRepo.DeleteIndex(indexName);
            await Task.CompletedTask;

            return(Ok("Index Deleted"));
        }