Exemple #1
0
        public static async Task <IActionResult> FunnelPage(
            [HttpTrigger(
                 AuthorizationLevel.Anonymous,
                 "get",
                 Route = "funnel-page/{token}"
                 )] HttpRequest req,
            string token,
            [Table(
                 "context",
                 "{token}",
                 "{token}",
                 Connection = "STORAGE_CONNECTION"
                 )] StringContentEntity sContext,
            ILogger log
            )
        {
            try
            {
                var context = JsonConvert
                              .DeserializeObject <Session>(sContext.Content);

                var content = $@"
                    <h1>Funnel Page</h1>
                    <table>
                    <tr>
                        <td><label>First Name</label></td>
                        <td><span>{context.Customer.FirstName}</span></td>
                    </tr>
                    <tr>
                        <td><label>Last Name</label></td>
                        <td><span>{context.Customer.LastName}</span></td>
                    </tr>
                    <tr>
                        <td><label>Email</label></td>
                        <td><span>{context.Customer.Email}</span></td>
                    </tr>
                    </table>";

                return(new ContentResult()
                {
                    Content = content,
                    ContentType = "text/html"
                });
            }
            catch (Exception ex)
            {
                log.LogError(ex.ToString());
                return(new ObjectResult(ex.Message));
            }
        }
 public static IActionResult GetSession(
     [HttpTrigger(
          AuthorizationLevel.Anonymous,
          "get",
          Route = "session/{token}"
          )] HttpRequest req,
     [Table(
          tableName: "context",
          partitionKey: "{token}",
          rowKey: "{token}",
          Connection = "STORAGE_CONNECTION"
          )] StringContentEntity entity
     )
 {
     return(new ContentResult()
     {
         Content = entity.Content,
         ContentType = "application/json",
         StatusCode = 200
     });
 }