public static async Task <IActionResult> CreateColor([HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = "colors")] HttpRequestMessage req, [Table("colorsTable", Connection = "MyTable")] CloudTable table, [Queue("color-added-queue", Connection = "MyTable")] IAsyncCollector <Color> outputQueue, TraceWriter log, ExecutionContext context) { log.Info($"Intent de crear un color"); try { var json = await req.Content.ReadAsStringAsync(); var color = JsonConvert.DeserializeObject <Color>(json); int code = await table.AddColorToTable(color); if (code == 204) { log.Info($"Color {color.Id} creat o modificat"); // Enqueue await outputQueue.AddAsync(color); // return(new CreatedResult("GetColor", color)); } else { return(new BadRequestObjectResult("Failed to create color")); } } catch (Exception e) { return(new BadRequestObjectResult("Can't create color: " + e.Message + " ")); } }