Ejemplo n.º 1
0
        public Events.ItemAdded On(Events.ItemAdded itemAdded)
        {
            Guard.AgainstNull(itemAdded, "itemAdded");

            _items.Add(itemAdded);

            Total += itemAdded.Price;

            return(itemAdded);
        }
Ejemplo n.º 2
0
        private Events.ItemAdded On(Events.ItemAdded itemAdded)
        {
            Guard.AgainstNull(itemAdded, nameof(itemAdded));

            _items.Add(itemAdded);

            Total += itemAdded.Price;

            return(itemAdded);
        }
Ejemplo n.º 3
0
        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);
        }