Skip to content

Instantly share code, notes, and snippets.

@dcomartin
Created March 12, 2016 20:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dcomartin/68adb70c0f1f26a4813f to your computer and use it in GitHub Desktop.
Save dcomartin/68adb70c0f1f26a4813f to your computer and use it in GitHub Desktop.
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