elsa-core/samples/Sample13/ActivityOutputWorkflow.cs

20 lines
865 B
C#
Raw Normal View History

2019-07-25 20:00:44 +00:00
using Elsa.Activities.Console.Activities;
using Elsa.Expressions;
using Elsa.Services;
using Elsa.Services.Models;
namespace Sample13
{
public class ActivityOutputWorkflow : IWorkflow
{
public void Build(IWorkflowBuilder builder)
{
builder
2019-09-17 14:32:09 +00:00
.StartWith<WriteLine>(x => x.TextExpression = new LiteralExpression("Hi! What's your name?"))
2019-07-25 20:00:44 +00:00
.Then<ReadLine>(id: "name")
.Then<WriteLine>(x => x.TextExpression = new JavaScriptExpression<string>("`${name.output.text}, that's a great name! Now, what's your age?`"))
.Then<ReadLine>(id: "age")
.Then<WriteLine>(x => x.TextExpression = new JavaScriptExpression<string>("`I see! So you were born in ${getDateOfBirth(parseInt(age.output.text))}. What a year to be alive!`"));
}
}
}