Simple Azure Function do Demonstrate in Excel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#r "Newtonsoft.Json" | |
using System.Net; | |
using Microsoft.AspNetCore.Mvc; | |
using Microsoft.Extensions.Primitives; | |
using Newtonsoft.Json; | |
public static async Task<IActionResult> Run(HttpRequest req, ILogger log) | |
{ | |
log.LogInformation("C# HTTP trigger function processed a request."); | |
string v1 = req.Query["value1"]; | |
string v2 = req.Query["value2"]; | |
if(v1!=null && v2!=null) | |
{ | |
int result = int.Parse(v1) + int.Parse(v2); | |
return (ActionResult)new OkObjectResult($"{result}"); | |
} | |
else | |
{ | |
return new BadRequestObjectResult("Invalid input"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment