Esempio n. 1
0
        /// <summary>
        /// Gets the Review.
        /// </summary>
        /// <param name="details">The details.</param>
        /// <returns></returns>
        public async Task <APIResponse> GetReview(ReviewIdDetails details)
        {
            try
            {
                var client   = httpClientFactory.CreateClient(BlogServiceOperation.serviceName);
                var response = await client.GetAsync(servicesConfig.Blog + BlogServiceOperation.GetReview(details.ReviewId));

                if (response.IsSuccessStatusCode)
                {
                    //var review = JsonConvert.DeserializeObject<ReviewResponseDetails>(await response.Content.ReadAsStringAsync());
                    var review = JsonConvert.DeserializeObject <ReviewResponse>(await response.Content.ReadAsStringAsync());
                    return(new APIResponse(review, HttpStatusCode.OK));
                }

                return(new APIResponse(response.StatusCode));
            }
            catch (Exception ex)
            {
                logger.Error(ex, "Exception in method 'GetReview()'");
                var exMessage = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
                return(new APIResponse(exMessage, HttpStatusCode.InternalServerError));
            }
        }