Skip to content

Instantly share code, notes, and snippets.

@orjan
Created October 1, 2009 18:05
Show Gist options
  • Save orjan/199130 to your computer and use it in GitHub Desktop.
Save orjan/199130 to your computer and use it in GitHub Desktop.
asp.net wizard api
public enum Steps
{
// Next and previous is always available if not the first step
Standard,
Verification,
// End-step, thanks for your order
Confirmation,
// End-step, Transition to cancel is always available but not from confirmation
Cancel
}
public class CustomerOrderFlow : Flow<CustomerStorage>
{
public CustomerOrderFlow()
{
// TODO: add system name and display name
// TODO: a problem with enterprise-details is that you don't know if it's available when the flow starts
// TODO: i think that Steps should be moved to interfaces instead
// ConfirmationStep, CancelStep, StandardStep and hidden from this implementation like
/*
Step(...);
Verification(...);
Cancel(...);
Confirmation(...);
*/
Step(Steps.Standard, "/controls/customer-details.ascx")
// This transition makes it possible to skip enterprise-details even if Customer.IsEnterprise
.Transition(Steps.Verification);
Step(Steps.Standard, "/controls/enterprise-details.ascx", s => s.Customer.IsEnterprise);
Step(Steps.Verification, "/controls/verification.ascx");
Step(Steps.Confirmation, "/controls/confirmation.ascx"); // E.g thank you for your order
Step(Steps.Cancel, "/controls/cancel.ascx"); // E.g. cancel and redirect
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment