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();
     }
 }
Ejemplo n.º 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));
            }
        }
Ejemplo n.º 3
0
        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);
 }