コード例 #1
0
 /// <summary>
 /// Unlikes current update
 /// </summary>
 /// <returns>Value containing true or false, depending on operation success, and response status</returns>
 /// <exception cref="LinkedInInvalidOperationException">Thrown when current update is not likable</exception>
 public LinkedInResponse <bool> Unlike()
 {
     try
     {
         if (!IsLikable)
         {
             throw new LinkedInInvalidOperationException("Likes are not allowed for this update");
         }
         var response = RequestRunner.LikeUnlikeUpdate(UpdateKey, false);
         var user     = Singleton.Instance.CurrentUser;
         _Likes.RemoveAll(l => l.Person.Id == user.Id);
         NumberOfLikes--;
         return(response);
     }
     catch (WebException wex)
     {
         return(Utils.GetResponse(false, wex, null));
     }
     catch (Exception ex)
     {
         return(new LinkedInResponse <bool>(false, LinkedInResponseStatus.OtherException, null, ex));
     }
 }