Skip to content

Instantly share code, notes, and snippets.

@sviataslau
Created March 19, 2021 14:57
Show Gist options
  • Save sviataslau/376d16b7477f757bad63d36909a36332 to your computer and use it in GitHub Desktop.
Save sviataslau/376d16b7477f757bad63d36909a36332 to your computer and use it in GitHub Desktop.
Resilience
public async Task<ActionResult> BuyProductAsync(ProductPurchase purchase) {
Customer customer = await dbContext.Customers.FindAsync(purchase.CustomerId);
Order order = await orderService.CreateOrderAsync(customer, purchase);
Payment payment = await paymentService.PostPaymentAsync(order);
await emailService.SendEmailAsync(customer.Email, new Email("Payment was processed!"));
await bus.PublishAsync(new OrderCreatedEvent { Id = order.Id });
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment