Esempio n. 1
0
        public static HttpResponseData Run([HttpTrigger(AuthorizationLevel.Anonymous, "get")] HttpRequestData req,
                                           FunctionContext executionContext)
        {
            var logger = executionContext.GetLogger("GetAll");

            logger.LogInformation("C# HTTP trigger function processed a request.");
            var repositorio = new TarefaRepositorio();
            var tarefas     = repositorio.GetAll();
            var okRetorno   = req.CreateResponse();

            if (tarefas == null)
            {
                okRetorno = req.CreateResponse(System.Net.HttpStatusCode.NoContent);
            }
            else
            {
                okRetorno.WriteAsJsonAsync(new OkObjectResult(tarefas));
            }

            return(okRetorno);
        }