public static IActionResult Run([HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequestMessage req, ILogger log) { log.LogInformation("SetProviderDefaultDateUpdated HTTP trigger function processed a request."); var output = new ProviderStorage().SetDefaultDateUpdatedAsync(log); //, out long rowcount); output.Wait(); return(new JsonResult(output.Result)); }
public static async Task <HttpResponseMessage> Run([HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequestMessage req, ILogger log) { log.LogInformation("C# HTTP trigger function processed a request."); ProviderSynchronise ps = new ProviderSynchronise(); List <ProviderService.ProviderRecordStructure> output = ps.SynchroniseProviders(DateTime.MinValue, log); log.LogInformation($"Inserting {output.Count} providers to CosmosDB providers collection"); Task <bool> task = new ProviderStorage().InsertDocs(output, log, true); // Truncate collection first task.Wait(); return(req.CreateResponse <string>(HttpStatusCode.OK, JsonConvert.SerializeObject(output))); }
public static async Task <HttpResponseMessage> Run([HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequestMessage req, ILogger log) { log.LogInformation("C# HTTP trigger function processed GetAllProviders request"); Task <IEnumerable <Providers.Provider> > task = new ProviderStorage().GetAll(log); task.Wait(); // Return results log.LogInformation($"GetAllProviders returning results"); //return req.CreateResponse<string>(HttpStatusCode.OK, JsonConvert.SerializeObject(task.Result)); HttpResponseMessage response = req.CreateResponse(HttpStatusCode.OK); response.Content = new StringContent(JsonConvert.SerializeObject(task.Result), Encoding.UTF8, "application/json"); return(response); }