コード例 #1
0
        private void TrackNewOrderCreatedEvent(OrderConfirmationContract orderConfirmation)
        {
            var eventContext = new Dictionary <string, string>
            {
                { "ConfirmationId", orderConfirmation.ConfirmationId },
                { "EmailAddress", orderConfirmation.Order.Customer.EmailAddress },
                { "Product", orderConfirmation.Order.Product.Name },
                { "ProductId", orderConfirmation.Order.Product.Id }
            };

            _telemetry.TrackEvent(OrderCreatedEvent, eventContext);
        }
コード例 #2
0
        private async Task <OrderConfirmationContract> StoreOrderAsync(OrderContract order)
        {
            var confirmationId = Guid.NewGuid().ToString();

            var dbOrder = Mapper.Map <Order>(order);

            dbOrder.ConfirmationId = confirmationId;

            var ordersRepository = await GetOrCreateOrdersRepositoryAsync();

            await ordersRepository.AddAsync(dbOrder);

            var orderConfirmation = new OrderConfirmationContract
            {
                ConfirmationId = confirmationId,
                Order          = order
            };

            return(orderConfirmation);
        }