/// <summary> /// Creates the CommentReply. /// </summary> /// <param name="request">The request.</param> /// <returns></returns> public async Task <APIResponse> CreateCommentReply(CreateCommentReplyBlogRequest request) { try { var client = httpClientFactory.CreateClient(BlogServiceOperation.serviceName); var param = JsonConvert.SerializeObject(request); HttpContent contentPost = new StringContent(param, Encoding.UTF8, "application/json"); var response = await client.PostAsync(servicesConfig.Blog + BlogServiceOperation.CreateCommentReply(), contentPost); if (response.IsSuccessStatusCode) { var commentReply = JsonConvert.DeserializeObject <CommentReplyResponse>(await response.Content.ReadAsStringAsync()); return(new APIResponse(commentReply, HttpStatusCode.Created)); } return(new APIResponse(response.StatusCode)); } catch (Exception ex) { logger.Error(ex, "Exception in method 'CreateCommentReply()'"); var exMessage = ex.InnerException != null ? ex.InnerException.Message : ex.Message; return(new APIResponse(exMessage, HttpStatusCode.InternalServerError)); } }
//[Authorize(Roles = "Admin, Vendor")] public async Task <IActionResult> CreateReview([FromBody] CreateCommentReplyBlogRequest request) { var result = await commentReplyService.CreateCommentReply(request); return(StatusCode((int)result.Code, result.Value)); }