public async Task Handle(Entities.Item.Events.ItemRemoved e, IMessageHandlerContext ctx) { var productitems = await ctx.UoW().Get <ProductBaskets>(e.ProductId) .ConfigureAwait(false); productitems.Baskets = productitems.Baskets.TryRemove(e.BasketId); await ctx.UoW().Update(e.ProductId, productitems).ConfigureAwait(false); }
public async Task Handle(Entities.Item.Events.ItemRemoved e, IMessageHandlerContext ctx) { var basket = await ctx.UoW().Get <Models.Basket>(e.BasketId) .ConfigureAwait(false); basket.Items = basket.Items.TryRemove(ItemIdGenerator(e.BasketId, e.ProductId), x => x.Id); await ctx.UoW().Update(e.BasketId, basket).ConfigureAwait(false); }
public async Task Handle(Entities.Item.Events.ItemRemoved e, IMessageHandlerContext ctx) { var basket = await ctx.UoW().Get <Models.BasketIndex>(e.BasketId) .ConfigureAwait(false); var item = await ctx.UoW() .Get <Entities.Item.Models.BasketItemIndex>(Entities.Item.BasketItemIndex.ItemIdGenerator(e.BasketId, e.ProductId)).ConfigureAwait(false); basket.TotalItems--; basket.TotalQuantity -= item.Quantity; basket.SubTotal -= item.SubTotal; await ctx.UoW().Update(e.BasketId, basket).ConfigureAwait(false); }