Esempio n. 1
0
        public async Task ReIndexElasticSearch()
        {
            var yeasts = await _yeastRepository.GetAllAsync("Supplier");

            var yeastsDto = Mapper.Map <IEnumerable <Yeast>, IEnumerable <YeastDto> >(yeasts);
            await _yeastElasticsearch.UpdateAllAsync(yeastsDto);
        }
Esempio n. 2
0
        public async Task ReIndexElasticSearch()
        {
            var yeasts = await _yeastRepository.GetAllAsync();

            var yeastsDto = AutoMapper.Mapper.Map <IEnumerable <Yeast>, IEnumerable <YeastDto> >(yeasts);
            var esYeasts  = await _yeastElasticsearch.GetAllAsync();

            var toDelete = esYeasts.Where(esy => yeasts.All(y => y.YeastId != esy.Id));
            await _yeastElasticsearch.DeleteListAsync(toDelete.Select(y => y.Id));

            await _yeastElasticsearch.UpdateAllAsync(yeastsDto);
        }