Example #1
0
 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);
     }
 }
Example #2
0
 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);
     }
 }
Example #3
0
 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);
     }
 }
Example #4
0
 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);
     }
 }