public static async Task <HttpResponseMessage> PostAsync( [HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = "httpmonitors")] HttpRequestMessage req, TraceWriter log, [Inject] IHttpMonitorService service, [Inject] JsonMediaTypeFormatter formatter) { var cmd = await req.Content.ReadAsAsync <CreateHttpMonitor>(new[] { formatter }); var httpMonitor = await service.CreateHttpMonitorAsync(cmd); return(req.CreateResponse(HttpStatusCode.OK, httpMonitor, formatter)); }
public async Task <IActionResult> Post([FromBody] CreateHttpMonitor command) { var httpMonitor = await _service.CreateHttpMonitorAsync(command); return(Ok(httpMonitor)); }