コード例 #1
0
        public async Task <IActionResult> Vote(int id)
        {
            try
            {
                await queueClient.SendVoteAsync(id);

                return(this.Ok());
            }
            catch (Exception ex) when(ex is VoteQueueException)
            {
                logger.LogError(ex, "Exception sending vote to the queue");
                return(BadRequest("Bad Request"));
            }
        }
コード例 #2
0
        public async Task <IActionResult> Vote(int id)
        {
            try
            {
                var data = new { Id = id };
                await queueClient.SendVoteAsync(JsonConvert.SerializeObject(data));

                return(this.Ok());
            }
            catch (Exception ex) when(ex is VoteQueueException)
            {
                logger.LogError(ex, "Exception sending vote to the queue");
                return(BadRequest("Bad Request"));
            }
        }