Exemplo n.º 1
0
        public override async Task <PagedResultDto <ProductOrderDto> > GetListAsync(MallRequestDto input)
        {
            var result = await base.GetListAsync(input);

            var shopDictionary = new Dictionary <Guid, MallShopDto>();

            foreach (var dto in result.Items)
            {
                if (dto.ShopId.HasValue)
                {
                    if (!shopDictionary.ContainsKey(dto.ShopId.Value))
                    {
                        var shop = await _mallShopLookupService.FindByIdAsync(dto.ShopId.Value);

                        if (shop != null)
                        {
                            shopDictionary[shop.Id] = ObjectMapper.Map <MallShop, MallShopDto>(shop);
                        }
                    }

                    if (shopDictionary.ContainsKey(dto.ShopId.Value))
                    {
                        dto.Shop = shopDictionary[(Guid)dto.ShopId];
                    }
                }
            }

            return(result);
        }
Exemplo n.º 2
0
        public async Task ShopLookupService_MUST_Copy_Default_Shop()
        {
            //Act
            var result = await _ShopLookupService.FindByIdAsync(TestConsts.Shop1Id);

            //Assert
            result.ShouldNotBe(null);
            result.Name.ShouldBe("TestShop");
            result.ShortName.ShouldBe("TS");
        }
Exemplo n.º 3
0
        public async Task ShopSync(ShopSyncRequestDto input)
        {
            var localShop = await _mallShopRepository.GetShopsAsync(input.ShopIds);

            foreach (var id in input.ShopIds)
            {
                if (localShop.All(x => x.Id != id))
                {
                    // shop will auto sync to mallShop table
                    var syncShop = await _mallShopLookupService.FindByIdAsync(id);
                }
            }

            await Task.CompletedTask;
        }
Exemplo n.º 4
0
        public async Task ShopSync(ShopSyncRequestDto input)
        {
            var localShops = await _mallShopRepository.GetShopsAsync(input.ShopIds);

            foreach (var localShop in localShops)
            {
                // if (localShop.All(x => x.Id != id))
                // {
                // shop will auto sync to mallShop table
                var syncShop = await _mallShopLookupService.FindByIdAsync(localShop.Id);

                //localShop.Update(syncShop as IShopData);
                // }
            }

            await Task.CompletedTask;
        }