Fixed bugs in Mobile.BFF.Shopping project
This commit is contained in:
parent
fcd42510ff
commit
f1c0db1118
@ -26,7 +26,7 @@ public class BasketController : ControllerBase
|
||||
}
|
||||
|
||||
// Retrieve the current basket
|
||||
var basket = await _basket.GetById(data.BuyerId) ?? new BasketData(data.BuyerId);
|
||||
var basket = await _basket.GetByIdAsync(data.BuyerId) ?? new BasketData(data.BuyerId);
|
||||
|
||||
var catalogItems = await _catalog.GetCatalogItemsAsync(data.Items.Select(x => x.ProductId));
|
||||
// group by product id to avoid duplicates
|
||||
@ -84,7 +84,7 @@ public class BasketController : ControllerBase
|
||||
}
|
||||
|
||||
// Retrieve the current basket
|
||||
var currentBasket = await _basket.GetById(data.BasketId);
|
||||
var currentBasket = await _basket.GetByIdAsync(data.BasketId);
|
||||
if (currentBasket == null)
|
||||
{
|
||||
return BadRequest($"Basket with id {data.BasketId} not found.");
|
||||
@ -126,7 +126,7 @@ public class BasketController : ControllerBase
|
||||
//item.PictureUri =
|
||||
|
||||
// Step 2: Get current basket status
|
||||
var currentBasket = (await _basket.GetById(data.BasketId)) ?? new BasketData(data.BasketId);
|
||||
var currentBasket = (await _basket.GetByIdAsync(data.BasketId)) ?? new BasketData(data.BasketId);
|
||||
// Step 3: Merge current status with new product
|
||||
currentBasket.Items.Add(new BasketDataItem()
|
||||
{
|
||||
|
@ -25,7 +25,7 @@ public class OrderController : ControllerBase
|
||||
return BadRequest("Need a valid basketid");
|
||||
}
|
||||
// Get the basket data and build a order draft based on it
|
||||
var basket = await _basketService.GetById(basketId);
|
||||
var basket = await _basketService.GetByIdAsync(basketId);
|
||||
|
||||
if (basket == null)
|
||||
{
|
||||
|
@ -11,7 +11,7 @@ public class BasketService : IBasketService
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public async Task<BasketData> GetById(string id)
|
||||
public async Task<BasketData> GetByIdAsync(string id)
|
||||
{
|
||||
_logger.LogDebug("grpc client created, request = {@id}", id);
|
||||
var response = await _basketClient.GetBasketByIdAsync(new BasketRequest { Id = id });
|
||||
|
Loading…
x
Reference in New Issue
Block a user