public async Task <IActionResult> Run( [HttpTrigger(AuthorizationLevel.Function, "post", Route = "Talks")] HttpRequest req, ILogger log) { log.LogInformation("Start Add Talks"); try { var body = await req.GetBodyAsync <List <TalkRequest> >(); if (!body.IsValid) { log.LogError($"Error - adding talks"); return(new BadRequestObjectResult(new { Message = string.Join(", ", body.ValidationResults.Select(s => s.ErrorMessage).ToArray()) })); return(new BadRequestResult()); } foreach (var item in body.Value) { log.LogInformation(JsonConvert.SerializeObject(item)); } await _talkService.AddTalks(body.Value); } catch (Exception ex) { log.LogError($"Error - adding talks"); return(new BadRequestObjectResult(new { Message = ex.Message + " - " + ex.StackTrace })); return(new BadRequestResult()); } return(new OkResult()); }