diff --git a/src/server/Elsa.Server.Host/Startup.cs b/src/server/Elsa.Server.Host/Startup.cs index 50b508d51..b64c2a96e 100644 --- a/src/server/Elsa.Server.Host/Startup.cs +++ b/src/server/Elsa.Server.Host/Startup.cs @@ -44,6 +44,7 @@ namespace Elsa.Server.Host .AddWorkflow() .AddWorkflow() .AddWorkflow() + .AddWorkflow() ; } diff --git a/src/server/Elsa.Server.Host/Workflows/ConditionWorkflow.cs b/src/server/Elsa.Server.Host/Workflows/ConditionWorkflow.cs new file mode 100644 index 000000000..5a32fb026 --- /dev/null +++ b/src/server/Elsa.Server.Host/Workflows/ConditionWorkflow.cs @@ -0,0 +1,24 @@ +using Elsa.Activities.Console; +using Elsa.Activities.ControlFlow; +using Elsa.Activities.Primitives; +using Elsa.Builders; + +namespace Elsa.Server.Host.Workflows +{ + public class ConditionWorkflow : IWorkflow + { + public void Build(IWorkflowBuilder workflow) + { + workflow + .WithDisplayName("Conditions") + .WriteLine("What is your age?") + .ReadLine() + .SetVariable("Age", context => int.Parse(context.GetInput())) + .IfElse(context => context.GetVariable("Age") < 18, ifElse => + { + ifElse.When(OutcomeNames.True).WriteLine("You are not allowed to drink beer."); + ifElse.When(OutcomeNames.False).WriteLine("Enjoy your beer!"); + }); + } + } +} \ No newline at end of file