-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathreports.cs
More file actions
57 lines (51 loc) · 1.78 KB
/
reports.cs
File metadata and controls
57 lines (51 loc) · 1.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
using System.Collections.Specialized;
using System.Linq;
using System.IO;
using Xenhey.BPM.Core.Net8.Implementation;
using Xenhey.BPM.Core.Net8;
using Newtonsoft.Json;
using Microsoft.Azure.Functions.Worker;
namespace AzureServiceBusToSQL
{
public class reports
{
private readonly ILogger _logger;
public reports(ILogger<reports> logger)
{
_logger = logger;
}
private HttpRequest _req;
private NameValueCollection nvc = new NameValueCollection();
[Function("reports")]
public IActionResult Run([HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "report/{reportid}")]
HttpRequest req, string reportid)
{
var input = JsonConvert.SerializeObject(new { reportid });
_req = req;
_logger.LogInformation("C# HTTP trigger function processed a request.");
string requestBody = input;
_req.Headers.ToList().ForEach(item => { nvc.Add(item.Key, item.Value.FirstOrDefault()); });
var results = orchrestatorService.Run(requestBody);
return resultSet(results);
}
private ActionResult resultSet(string reponsePayload)
{
var returnContent = new ContentResult();
var mediaSelectedtype = nvc.Get("Content-Type");
returnContent.Content = reponsePayload;
returnContent.ContentType = mediaSelectedtype;
return returnContent;
}
private IOrchestrationService orchrestatorService
{
get
{
return new RemoteOrchrestratorService(nvc);
}
}
}
}