public static async Task <IActionResult> Run( [HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequest req, [Inject] IPrimaryInterface primaryInterface, ILogger log) { log.LogInformation("C# HTTP trigger function processed a request."); string name = req.Query["name"]; string requestBody = await new StreamReader(req.Body).ReadToEndAsync(); dynamic data = JsonConvert.DeserializeObject(requestBody); name = name ?? data?.name; if (name == null) { return(new BadRequestObjectResult("Please pass a name on the query string or in the request body")); } else { name = primaryInterface.ThisIsAMethod("hello", name); return((ActionResult) new OkObjectResult($"Hello, {name}")); } }
public string TestMethod(string hello, string world) { return(_primaryInterface.ThisIsAMethod(hello, world)); }