Пример #1
0
        public static async Task <IActionResult> Run(
            [HttpTrigger(AuthorizationLevel.Function, "post", Route = null)] LevelCompleteRequest req,
            ILogger log)
        {
            log.LogInformation($"{nameof(LevelCompleteFn)} processed a request.");

            log.LogInformation($"Level: {req.FunctionParameter.level} Points: {req.FunctionParameter.points}");

            await Task.Delay(50); // Simulate some async work

            return((ActionResult) new OkObjectResult($"Congrats on completing level {req.FunctionParameter.level}"));
        }
Пример #2
0
        public static async Task <IActionResult> Run(
            [HttpTrigger(AuthorizationLevel.Function, "post", Route = null)] HttpRequest httpReq,
            ILogger log)
        {
            log.LogInformation($"{nameof(LevelCompleteUntypedRequestFn)} processed a request.");

            string body = await httpReq.ReadAsStringAsync();

            LevelCompleteRequest req = JsonConvert.DeserializeObject <LevelCompleteRequest>(body);

            log.LogInformation($"Level: {req.FunctionParameter.level} Points: {req.FunctionParameter.points}");

            await Task.Delay(50); // Simulate some async work

            return((ActionResult) new OkObjectResult($"Congrats on completing level {req.FunctionParameter.level}"));
        }