Skip to content

Commit e41ce96

Browse files
Minor refactoring related to the ProductPriceChanged integration event
1 parent faf4ada commit e41ce96

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

src/Services/Basket/Basket.API/Events/CatalogPriceChangedHandler.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ public async Task Handle(ProductPriceChanged @event)
2222
foreach (var id in userIds)
2323
{
2424
var basket = await _repository.GetBasket(id);
25-
await UpdateBasket(@event.ItemId, @event.NewPrice, basket);
25+
await UpdateBasket(@event.ProductId, @event.NewPrice, basket);
2626
}
2727
}
2828

29-
private async Task UpdateBasket(int itemId, decimal newPrice, CustomerBasket basket)
29+
private async Task UpdateBasket(int productId, decimal newPrice, CustomerBasket basket)
3030
{
31-
var itemsToUpdate = basket?.Items?.Where(x => int.Parse(x.ProductId) == itemId).ToList();
31+
var itemsToUpdate = basket?.Items?.Where(x => int.Parse(x.ProductId) == productId).ToList();
3232
if (itemsToUpdate != null)
3333
{
3434
foreach (var item in itemsToUpdate)

src/Services/Common/Infrastructure/Catalog/ProductPriceChanged.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ namespace Microsoft.eShopOnContainers.Services.Common.Infrastructure.Catalog
66
{
77
public class ProductPriceChanged : IntegrationEventBase
88
{
9-
public int ItemId { get; private set; }
9+
public int ProductId { get; private set; }
1010

1111
public decimal NewPrice { get; private set; }
1212

13-
public decimal OldPrice { get; set; }
13+
public decimal OldPrice { get; private set; }
1414

15-
public ProductPriceChanged(int itemId, decimal newPrice, decimal oldPrice)
15+
public ProductPriceChanged(int productId, decimal newPrice, decimal oldPrice)
1616
{
17-
ItemId = itemId;
17+
ProductId = productId;
1818
NewPrice = newPrice;
1919
OldPrice = oldPrice;
2020
}

0 commit comments

Comments
 (0)