public CommentViewModel GetComment(int commentId) { try { var result = CommentServiceHttpClient.GetAsync(ADDRESS + "getcomment/" + commentId).Result; return(result.Content.ReadAsAsync <CommentViewModel>().Result); } catch (FaultException ex) { throw new ApplicationException(ex.Message); } }
public int DeleteComment(CommentViewModel commentViewModel) { try { var result = CommentServiceHttpClient.PostAsync(ADDRESS + "deletecomment", new StringContent(JsonConvert.SerializeObject(commentViewModel), Encoding.UTF8, "application/json")).Result; return(result.Content.ReadAsAsync <int>().Result); } catch (FaultException ex) { throw new ApplicationException(ex.Message); } }
public IEnumerable <CommentViewModel> GetIndependentComments(int postId) { try { var result = CommentServiceHttpClient.GetAsync(ADDRESS + "getindependentcomments/" + postId).Result; return(result.Content.ReadAsAsync <IEnumerable <CommentViewModel> >().Result); } catch (FaultException ex) { throw new ApplicationException(ex.Message); } }
public bool HaveMoreThanFourLevels(CommentViewModel commentViewModel) { try { var result = CommentServiceHttpClient.PostAsync(ADDRESS + "havemorethanfourlevels", new StringContent(JsonConvert.SerializeObject(commentViewModel), Encoding.UTF8, "application/json")).Result; return(result.Content.ReadAsAsync <bool>().Result); } catch (FaultException ex) { throw new ApplicationException(ex.Message); } }