public IEnumerable <PostViewModel> GetPostsByUserNameWithoutCategory(string userName) { try { var result = PostServiceHttpClient.GetAsync(ADDRESS + "getuserpostswithoutcategory/" + userName).Result; return(result.Content.ReadAsAsync <IEnumerable <PostViewModel> >().Result); } catch (FaultException ex) { throw new ApplicationException(ex.Message); } }
public IEnumerable <PostViewModel> GetUserPosts(int userId) { try { var result = PostServiceHttpClient.GetAsync(ADDRESS + "getuserposts/" + userId).Result; return(result.Content.ReadAsAsync <IEnumerable <PostViewModel> >().Result); } catch (FaultException ex) { throw new ApplicationException(ex.Message); } }
public IEnumerable <PostViewModel> GetUserPostsByUserName(string userName) { try { var result = PostServiceHttpClient.GetAsync(ADDRESS + "getuserpostsbyusername/" + userName).Result; return(result.Content.ReadAsAsync <PostViewModel[]>().Result.ToEnumerable()); } catch (FaultException ex) { throw new ApplicationException(ex.Message); } }
public PostViewModel GetPost(int postId) { try { var result = PostServiceHttpClient.GetAsync(ADDRESS + "getpost/" + postId).Result; return(result.Content.ReadAsAsync <PostViewModel>().Result); } catch (FaultException ex) { throw new ApplicationException(ex.Message); } }