Browse Source

web bff endpoint /api/v1/Basket working in grpc

features/migration-dotnet3
ericuss 5 years ago
parent
commit
260bfcbc45
1 changed files with 30 additions and 30 deletions
  1. +30
    -30
      src/ApiGateways/Web.Bff.Shopping/aggregator/Services/BasketService.cs

+ 30
- 30
src/ApiGateways/Web.Bff.Shopping/aggregator/Services/BasketService.cs View File

@ -96,18 +96,6 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Services
}
}
}
//_httpClient.BaseAddress = new Uri(_urls.Basket + UrlsConfig.BasketOperations.UpdateBasket());
//var client = GrpcClient.Create<Basket.BasketClient>(_httpClient);
//_logger.LogInformation("Grpc update basket currentBasket {@currentBasket}", currentBasket);
//var request = MapToCustomerBasketRequest(currentBasket);
//_logger.LogInformation("Grpc update basket request {@request}", request);
//await client.UpdateBasketAsync(request);
}
private BasketData MapToBasketData(CustomerBasketResponse customerBasketRequest)
@ -122,16 +110,22 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Services
BuyerId = customerBasketRequest.Buyerid
};
customerBasketRequest.Items.ToList().ForEach(item => map.Items.Add(new BasketDataItem
customerBasketRequest.Items.ToList().ForEach(item =>
{
Id = item.Id,
OldUnitPrice = (decimal)item.Oldunitprice,
PictureUrl = item.Pictureurl,
ProductId = item.Productid,
ProductName = item.Productname,
Quantity = item.Quantity,
UnitPrice = (decimal)item.Unitprice
}));
if (item.Id != null)
{
map.Items.Add(new BasketDataItem
{
Id = item.Id,
OldUnitPrice = (decimal)item.Oldunitprice,
PictureUrl = item.Pictureurl,
ProductId = item.Productid,
ProductName = item.Productname,
Quantity = item.Quantity,
UnitPrice = (decimal)item.Unitprice
});
}
});
return map;
}
@ -148,16 +142,22 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Services
Buyerid = basketData.BuyerId
};
basketData.Items.ToList().ForEach(item => map.Items.Add(new BasketItemResponse
basketData.Items.ToList().ForEach(item =>
{
Id = item.Id,
Oldunitprice = (double)item.OldUnitPrice,
Pictureurl = item.PictureUrl,
Productid = item.ProductId,
Productname = item.ProductName,
Quantity = item.Quantity,
Unitprice = (double)item.UnitPrice
}));
if (item.Id != null)
{
map.Items.Add(new BasketItemResponse
{
Id = item.Id,
Oldunitprice = (double)item.OldUnitPrice,
Pictureurl = item.PictureUrl,
Productid = item.ProductId,
Productname = item.ProductName,
Quantity = item.Quantity,
Unitprice = (double)item.UnitPrice
});
}
});
return map;
}


Loading…
Cancel
Save