public ActionResult Buy(int id) { var customer = _customerRepository.GetCustomerByName(User.Identity.Name); var product = _productsRepository.GetProduct(id); var promotion = _promotionsRepository.GetPromotion(customer.CustomerId, product.Id); var purchaseEvent = new PurchaseEvent { CustomerId = customer.CustomerId, ProductId = id, Price = promotion != null ? promotion.NewPrice : product.Price, PurchaseTime = DateTime.Now, OrderId = Guid.NewGuid() }; _telemetryRepository.SendPurchase(purchaseEvent); Thread.Sleep(TimeSpan.FromSeconds(5)); return(new HttpStatusCodeResult(HttpStatusCode.OK)); }