示例#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);
     }
 }
示例#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);
     }
 }
示例#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);
     }
 }
示例#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);
     }
 }