File tree Expand file tree Collapse file tree
src/Services/Catalog/Catalog.API/Controllers Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -180,7 +180,7 @@ public async Task<IActionResult> UpdateProduct([FromBody]CatalogItem productToUp
180180 catalogItem = productToUpdate ;
181181 _catalogContext . CatalogItems . Update ( catalogItem ) ;
182182
183- if ( raiseProductPriceChangedEvent ) // Save and publish integration event if price has changed
183+ if ( raiseProductPriceChangedEvent ) // Save product's data and publish integration event through the Event Bus if price has changed
184184 {
185185 //Create Integration Event to be published through the Event Bus
186186 var priceChangedEvent = new ProductPriceChangedIntegrationEvent ( catalogItem . Id , productToUpdate . Price , oldPrice ) ;
@@ -191,7 +191,7 @@ public async Task<IActionResult> UpdateProduct([FromBody]CatalogItem productToUp
191191 // Publish through the Event Bus and mark the saved event as published
192192 await _catalogIntegrationEventService . PublishThroughEventBusAsync ( priceChangedEvent ) ;
193193 }
194- else // Save updated product
194+ else // Just save the updated product because the Product's Price hasn't changed.
195195 {
196196 await _catalogContext . SaveChangesAsync ( ) ;
197197 }
You can’t perform that action at this time.
0 commit comments