public Events.ItemAdded On(Events.ItemAdded itemAdded) { Guard.AgainstNull(itemAdded, "itemAdded"); _items.Add(itemAdded); Total += itemAdded.Price; return(itemAdded); }
private Events.ItemAdded On(Events.ItemAdded itemAdded) { Guard.AgainstNull(itemAdded, nameof(itemAdded)); _items.Add(itemAdded); Total += itemAdded.Price; return(itemAdded); }
public async Task Handle(Events.ItemAdded e, IMessageHandlerContext ctx) { var product = await ctx.UoW().Get <Catalog.Product.Models.CatalogProductIndex>(e.ProductId) .ConfigureAwait(false); var model = new Models.BasketItemIndex { Id = ItemIdGenerator(e.BasketId, e.ProductId), BasketId = e.BasketId, ProductId = e.ProductId, ProductName = product.Name, ProductDescription = product.Description, ProductPictureContents = product.PictureContents, ProductPictureContentType = product.PictureContentType, ProductPrice = product.Price, Quantity = 1, }; await ctx.UoW().Add(model.Id, model).ConfigureAwait(false); }