public async Task UpdatePricesForIntegrationEvent(Models.PriceUpdate priceUpdate) { await using (var shoppingBasketDbContext = new ShoppingBasketDbContext(dbContextOptions)) { var basketLinesToUpdate = shoppingBasketDbContext.BasketLines.Where(x => x.EventId == priceUpdate.EventId); await basketLinesToUpdate.ForEachAsync((basketLineToUpdate) => basketLineToUpdate.Price = priceUpdate.Price ); await shoppingBasketDbContext.SaveChangesAsync(); } }
public async Task UpdatePricesForIntegrationEvent(Models.PriceUpdate priceUpdate) { var basketLinesToUpdate = shoppingBasketDbContext.BasketLines.Where(x => x.EventId == priceUpdate.EventId); await basketLinesToUpdate.ForEachAsync((basketLineToUpdate) => basketLineToUpdate.Price = priceUpdate.Price ); //foreach (var basketLineToUpdate in basketLinesToUpdate) //{ // basketLineToUpdate.Price = priceUpdate.Price; //} await SaveChanges(); }