Пример #1
0
        private decimal CalculateCartTotal(CartProjection projection)
        {
            decimal total = 0;

            foreach (var product in projection.Products)
            {
                total += product.Quantity * product.SalePrice;
            }
            return(total);
        }
Пример #2
0
        public async Task ExecuteAsync(CartCreated evt)
        {
            var cartProjection = new CartProjection
            {
                CartId = evt.AggregateId,
                UserId = evt.UserId
            };

            await Repository.UpsertAsync(cartProjection, evt);
        }