in Functions.Templates/Templates/DurableFunctionsEntityHttp-CSharp-2.x/DurableFunctionsEntityHttpCSharp.cs [14:29]
public static async Task<HttpResponseMessage> Run(
[HttpTrigger(AuthorizationLevel.Function, Route = "Counter/{entityKey}")] HttpRequestMessage req,
[DurableClient] IDurableEntityClient client,
string entityKey)
{
var entityId = new EntityId(nameof(Counter), entityKey);
if (req.Method == HttpMethod.Post)
{
await client.SignalEntityAsync(entityId, "add", 1);
return req.CreateResponse(HttpStatusCode.OK);
}
EntityStateResponse<JToken> stateResponse = await client.ReadEntityStateAsync<JToken>(entityId);
return req.CreateResponse(HttpStatusCode.OK, stateResponse.EntityState);
}