public async Task<IActionResult> Post([FromBody]Activity activity)
 {
     try
     {
         await activityAdapter.Receive(this.Request.Headers["Authorization"].FirstOrDefault(), activity);
         return this.Ok();
     }
     catch (UnauthorizedAccessException)
     {
         return this.Unauthorized();
     }
 }
Beispiel #2
0
        /// <summary>
        /// POST: api/Messages
        /// Receive a message from a user and reply to it
        /// </summary>
        public async Task <HttpResponseMessage> Post([FromBody] Activity activity)
        {
            try
            {
                await _adapter.Receive(this.Request.Headers.Authorization?.Parameter, activity);

                return(this.Request.CreateResponse(HttpStatusCode.OK));
            }
            catch (UnauthorizedAccessException e)
            {
                return(this.Request.CreateErrorResponse(HttpStatusCode.Unauthorized, e.Message));
            }
            catch (InvalidOperationException e)
            {
                return(this.Request.CreateErrorResponse(HttpStatusCode.NotFound, e.Message));
            }
        }
        public async Task <IActionResult> Post([FromBody] Activity activity)
        {
            try
            {
                await _adapter.Receive(this.Request.Headers["Authorization"].FirstOrDefault(), activity);

                return(this.Ok());
            }
            catch (UnauthorizedAccessException)
            {
                return(this.Unauthorized());
            }
            catch (InvalidOperationException e)
            {
                return(this.NotFound(e.Message));
            }
        }
 public async void Post([FromBody] Activity activity)
 {
     await activityAdapter.Receive(HttpContext.Request.Headers, activity);
 }