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); }
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); }