Skip to content

Instantly share code, notes, and snippets.

Created December 2, 2020 22:53
What would you like to do?
using System.Threading.Tasks;
using DotNetCore.CAP;
using Microsoft.EntityFrameworkCore;
using Sales.Contracts;
namespace Shipping
public class CancelShippingLabel : ICapSubscribe
private readonly ShippingDbContext _dbContext;
public CancelShippingLabel(ShippingDbContext dbContext)
_dbContext = dbContext;
public async Task Handle(OrderCancelled orderCancelled)
var order = await _dbContext.ShippingLabels.SingleAsync(x => x.OrderId == orderCancelled.OrderId);
order.Cancelled = true;
await _dbContext.SaveChangesAsync();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment