public static async Task <IActionResult> Run( [HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequest req, [Inject] IPrimaryInterface primaryInterface, ILogger log) { log.LogInformation("C# HTTP trigger function processed a request."); string name = req.Query["name"]; string requestBody = await new StreamReader(req.Body).ReadToEndAsync(); dynamic data = JsonConvert.DeserializeObject(requestBody); name = name ?? data?.name; if (name == null) { return(new BadRequestObjectResult("Please pass a name on the query string or in the request body")); } else { name = primaryInterface.ThisIsAMethod("hello", name); return((ActionResult) new OkObjectResult($"Hello, {name}")); } }
public void InitializeContainer() { var services = new ServiceCollection(); services.AddClassLibraryDependencies(); var provider = services.BuildServiceProvider(); _primary = provider.GetService <IPrimaryInterface>(); }
public TestClass(IPrimaryInterface primaryInterface) { _primaryInterface = primaryInterface; }