Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Subscriber : ModelBase, ISubscriber
- {
- public string id { get; set; }
- public Boolean IsFan(string objectId, FacebookClient client)
- {
- dynamic result = client.Get(String.Format("/{0}/likes", id));
- this.LogInfo(String.Format("Checking, whether {0} likes {1}", id, objectId));
- try
- {
- if (Enumerable.Count(result.data) > 0)
- {
- foreach (dynamic item in result.data)
- {
- if (item.id == objectId)
- {
- this.LogInfo(String.Format("{0} likes {1}", id, item.id));
- return true;
- }
- this.LogDebug(String.Format("{0} likes {1}", id, item.id));
- }
- }
- else
- {
- this.LogError("Error while getting likes for subscriber {0}. There seem to be no likes. Facebook query result was:");
- this.LogError(result.ToString());
- return true;
- }
- }
- catch (Exception ex)
- {
- this.LogError("Error while getting likes for subscriber {0}. Facebook query result was:");
- this.LogError(result.ToString());
- this.LogError("Error was:");
- this.LogError(ex.ToString());
- return true;
- }
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement