Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
public class ChangePricingLevelHandler : IAsyncRequestHandler<ChangeCustomerPricingLevel, Unit>
{
private CustomerContext _db;
public ChangePricingLevelHandler(CustomerContext db)
{
_db = db;
}
public async Task<Unit> Handle(ChangeCustomerPricingLevel message)
{
var customer = _db.Customers.Single(x => x.CustomerId == message.CustomerId);
customer.PrivingLevel = message.PricingLevel;
await _db.SaveChangesAsync();
return Unit.Value;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment