elsa-core/samples/Sample06/HelloWorldWorkflow.cs

27 lines
981 B
C#
Raw Normal View History

2019-07-14 10:07:58 +00:00
using System;
using System.Net;
using Elsa.Activities.Http.Activities;
2019-07-20 21:58:34 +00:00
using Elsa.Expressions;
2019-07-14 10:07:58 +00:00
using Elsa.Services;
using Elsa.Services.Models;
namespace Sample06
{
public class HelloWorldWorkflow : IWorkflow
{
public void Build(IWorkflowBuilder builder)
{
builder
.StartWith<HttpRequestEvent>(activity => activity.Path = new Uri("/hello-world", UriKind.RelativeOrAbsolute))
2019-07-25 16:10:17 +00:00
.Then<HttpResponseAction>(
2019-07-14 10:07:58 +00:00
activity =>
{
activity.Content = new PlainTextExpression("<h1>Hello World!</h1><p>Elsa says hi :)</p>");
activity.ContentType = new PlainTextExpression("text/html");
activity.StatusCode = HttpStatusCode.OK;
activity.ResponseHeaders = new PlainTextExpression("X-Powered-By=Elsa Workflows");
}
);
}
}
2019-06-28 16:55:12 +00:00
}