Updating the function code

Let's take a look at the following steps to update the function code:

  1. Using Solution Explorer, open ScoreText.cs.
  2. Remove processing the parameters from the body, and add an output of a text sentiment score between 0 and 1, which is generated by using the C# Random function, as shown in the following code sample:
    using System;    namespace TextEvaluation    {     public static class ScoreText     {       [FunctionName("ScoreText")]       public static async Task<HttpResponseMessage>           Run([HttpTrigger(AuthorizationLevel.Anonymous, "get", "post",         Route = null)]HttpRequestMessage req, TraceWriter log)       {           // parse query parameter           string name = req.GetQueryNameValuePairs()          .FirstOrDefault(q => string.Compare(q.Key, "name", true) ==             0) .Value; ...

Get Serverless computing in Azure with .NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.