public void GetUserFeedBySite(string UserId, string WPUserId, string SiteId, string AccessToken)
        {
            Domain.Myfashion.Domain.WordpressFeeds _WordpressFeeds = new Domain.Myfashion.Domain.WordpressFeeds();
            oAuthWordpress _oAuth = new oAuthWordpress();

            _oAuth.access_token = AccessToken;
            string  userposts    = _oAuth.APIWebRequestToGetUserInfo(Globals._UserPosts.Replace("[SiteId]", SiteId));
            JObject User_Site    = JObject.Parse(userposts);
            var     postcontaint = User_Site["posts"];

            foreach (var post_item in postcontaint)
            {
                _WordpressFeeds.Id           = Guid.NewGuid();
                _WordpressFeeds.SiteId       = post_item["site_ID"].ToString();
                _WordpressFeeds.PostId       = post_item["ID"].ToString();
                _WordpressFeeds.CreatedTime  = DateTime.Parse(post_item["date"].ToString());
                _WordpressFeeds.ModifiedTime = DateTime.Parse(post_item["modified"].ToString());
                _WordpressFeeds.Title        = post_item["title"].ToString();
                _WordpressFeeds.PostUrl      = post_item["URL"].ToString();
                _WordpressFeeds.PostContent  = post_item["content"].ToString();
                _WordpressFeeds.CommentCount = post_item["comment_count"].ToString();
                _WordpressFeeds.LikeCount    = post_item["like_count"].ToString();
                _WordpressFeeds.ILike        = post_item["i_like"].ToString();
                _WordpressFeeds.EntryTime    = DateTime.Now;
                _WordpressFeeds.WPUserId     = WPUserId;
                _WordpressFeeds.UserId       = Guid.Parse(UserId);

                if (!objWordpressFeedsRepository.checkWordpressFeedExists(_WordpressFeeds.PostId, Guid.Parse(UserId), SiteId))
                {
                    objWordpressFeedsRepository.addWordpressFeed(_WordpressFeeds);
                }
            }
        }
 public void addWordpressFeed(Domain.Myfashion.Domain.WordpressFeeds _WordpressFeeds)
 {
     //Creates a database connection and opens up a session
     using (NHibernate.ISession session = SessionFactory.GetNewSession())
     {
         //Begin session trasaction and opens up.
         using (NHibernate.ITransaction transaction = session.BeginTransaction())
         {
             //Procees action, to save new data.
             session.Save(_WordpressFeeds);
             transaction.Commit();
         } //End Trasaction
     }     //End session
 }
        public void GetUserFeedBySite(string UserId, string WPUserId, string SiteId, string AccessToken)
        {
            Domain.Myfashion.Domain.WordpressFeeds _WordpressFeeds = new Domain.Myfashion.Domain.WordpressFeeds();
            oAuthWordpress _oAuth = new oAuthWordpress();
            _oAuth.access_token = AccessToken;
            string userposts = _oAuth.APIWebRequestToGetUserInfo(Globals._UserPosts.Replace("[SiteId]",SiteId));
            JObject User_Site = JObject.Parse(userposts);
            var postcontaint = User_Site["posts"];
            foreach (var post_item in postcontaint)
            {
                _WordpressFeeds.Id=Guid.NewGuid();
                _WordpressFeeds.SiteId = post_item["site_ID"].ToString();
                _WordpressFeeds.PostId = post_item["ID"].ToString();
                _WordpressFeeds.CreatedTime = DateTime.Parse(post_item["date"].ToString());
                _WordpressFeeds.ModifiedTime = DateTime.Parse(post_item["modified"].ToString());
                _WordpressFeeds.Title = post_item["title"].ToString();
                _WordpressFeeds.PostUrl = post_item["URL"].ToString();
                _WordpressFeeds.PostContent = post_item["content"].ToString();
                _WordpressFeeds.CommentCount = post_item["comment_count"].ToString();
                _WordpressFeeds.LikeCount = post_item["like_count"].ToString();
                _WordpressFeeds.ILike = post_item["i_like"].ToString();
                _WordpressFeeds.EntryTime = DateTime.Now;
                _WordpressFeeds.WPUserId = WPUserId;
                _WordpressFeeds.UserId = Guid.Parse(UserId);

                if (!objWordpressFeedsRepository.checkWordpressFeedExists(_WordpressFeeds.PostId,Guid.Parse(UserId),SiteId))
                {
                    objWordpressFeedsRepository.addWordpressFeed(_WordpressFeeds); 
                }
            }
        }