Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
public class Module : NancyModule
{
public Module(IMediator mediator)
{
Put["/customers/{CustomerId:Guid}/changepricinglevel/{MessageId:Guid}", true] = async (parameters, token) =>
{
var cmd = this.Bind<Command>();
var envelope = new Envelope<Command>((Guid)parameters.MessageId, cmd);
try
{
await mediator.SendAsync(envelope);
return HttpStatusCode.NoContent;
}
catch (Exception ex)
{
ex.ToExceptionless()
// Set the reference id of the event so we can search for it later (reference:id).
// This will automatically be populated if you call ExceptionlessClient.Default.Configuration.UseReferenceIds();
.SetReferenceId(((Guid)parameters.MessageId).ToString("N"))
// Add the envelope command object
.AddObject(envelope, "ChangePricingLevel")
// Set the customerId
.SetProperty("CustomerId", parameters.CustomerID)
// Add an Command tag.
.AddTags("Command")
// Mark critical.
.MarkAsCritical()
// Submit the event.
.Submit();
return HttpStatusCode.InternalServerError;
}
};
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment