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); }
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"); }
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; }
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; }