Esempio n. 1
0
        public static async Task <IActionResult> Run(
            [HttpTrigger(AuthorizationLevel.Function, "post", Route = null)] FunctionExecutionContext <LevelComplete> req,
            ILogger log)
        {
            log.LogInformation($"{nameof(LevelCompleteGenericFn)} 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}"));
        }
        public static async Task <IActionResult> Run(
            [HttpTrigger(AuthorizationLevel.Function, "post", Route = null)] HttpRequest httpReq,
            ILogger log)
        {
            log.LogInformation($"{nameof(LevelCompleteUntypedRequestGenericFn)} processed a request.");

            string body = await httpReq.ReadAsStringAsync();

            FunctionExecutionContext <LevelComplete> req = JsonConvert.DeserializeObject <FunctionExecutionContext <LevelComplete> >(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}"));
        }
        public static async Task <IActionResult> Run(
            [HttpTrigger(AuthorizationLevel.Function, "post", Route = null)] FunctionExecutionContext <LevelComplete> req,
            HttpRequest httpRequest,
            ILogger log)
        {
            log.LogInformation($"{nameof(LevelCompleteDualBindingGenericFn)} processed a request.");

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

            log.LogInformation($"HTTPS: {httpRequest.IsHttps}");

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

            // Crash
            string crash = null;

            log.LogInformation($"String is {crash.Length} characters");

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