示例#1
0
        public async Task ReindexAsync()
        {
            await SearchRepository.RemoveAllAsync();

            var discounts = await DiscountRepository.GetAllAsync();

            var searchList = await GetAllSearchAsync(discounts);

            await SearchRepository.CreateManyAsync(searchList);
        }
示例#2
0
        public async Task ReindexAsync()
        {
            await SearchRepository.RemoveAllAsync();

            var vendors = await _vendorRepository.GetAllAsync();

            var allDiscounts = await _discountRepository.GetAllAsync();

            var vendorsDto = vendors.GroupJoin(
                allDiscounts,
                vendor => vendor.Id,
                discount => discount.VendorId,
                (vendor, discounts) =>
            {
                var vendorDto       = _mapper.Map <VendorDto>(vendor);
                vendorDto.Discounts = _mapper.Map <IEnumerable <DiscountShortDto> >(discounts);
                return(vendorDto);
            });

            var searchList = await GetAllSearchAsync(vendorsDto);

            await SearchRepository.CreateManyAsync(searchList);
        }