コード例 #1
0
        public string AddComment(string UserId, string FeedId, string Text, string InstagramId)
        {
            MongoRepository instagarmCommentRepo = new MongoRepository("InstagramComment");
            Domain.Socioboard.MongoDomain.InstagramComment _InstagramComment = new Domain.Socioboard.MongoDomain.InstagramComment();
            //GlobusInstagramLib.Authentication.ConfigurationIns configi = new GlobusInstagramLib.Authentication.ConfigurationIns("https://api.instagram.com/oauth/authorize/", ConfigurationManager.AppSettings["InstagramClientKey"], ConfigurationManager.AppSettings["InstagramClientSec"], ConfigurationManager.AppSettings["RedirectUrl"], "http://api.instagram.com/oauth/access_token", "https://api.instagram.com/v1/", "");
            //oAuthInstagram _api = new oAuthInstagram();
            //_api = oAuthInstagram.GetInstance(configi);
            objInstagramAccount = objInstagramAccountRepository.getInstagramAccountDetailsById(InstagramId);
            CommentController objComment = new CommentController();
            string ret = objComment.PostCommentAdd(FeedId, Text, objInstagramAccount.AccessToken);

            if (!string.IsNullOrEmpty(ret))
            {
                try
                {
                    JObject JData = JObject.Parse(ret);
                    string commentid = JData["data"]["id"].ToString();
                    string time = JData["data"]["created_time"].ToString();
                    string profilepic = JData["data"]["from"]["profile_picture"].ToString();
                    string username = JData["data"]["from"]["username"].ToString();
                    _InstagramComment.Id = ObjectId.GenerateNewId();
                    _InstagramComment.strId = ObjectId.GenerateNewId().ToString();
                    _InstagramComment.FeedId = FeedId;
                    _InstagramComment.InstagramId = InstagramId;
                    _InstagramComment.FromProfilePic = profilepic;
                    _InstagramComment.FromName = username;
                    _InstagramComment.CommentDate = time;
                    _InstagramComment.Comment = Text;
                    _InstagramComment.CommentId = commentid;
                    //objInstagramCommentRepository.addInstagramComment(_InstagramComment);

                    instagarmCommentRepo.Add(_InstagramComment);
                }
                catch (Exception ex)
                {
                    logger.Error(ex.Message);
                    return null;
                }

            }
            else { return null; }

            return new JavaScriptSerializer().Serialize(_InstagramComment);


        }
コード例 #2
0
        public string AddComment(string UserId, string FeedId, string Text, string InstagramId)
        {

            GlobusInstagramLib.Authentication.ConfigurationIns configi = new GlobusInstagramLib.Authentication.ConfigurationIns("https://api.instagram.com/oauth/authorize/", ConfigurationManager.AppSettings["InstagramClientKey"], ConfigurationManager.AppSettings["InstagramClientSec"], ConfigurationManager.AppSettings["RedirectUrl"], "http://api.instagram.com/oauth/access_token", "https://api.instagram.com/v1/", "");
            oAuthInstagram _api = new oAuthInstagram();
            _api = oAuthInstagram.GetInstance(configi);
            objInstagramAccount = objInstagramAccountRepository.getInstagramAccountDetailsById(InstagramId, Guid.Parse(UserId));
            CommentController objComment = new CommentController();

            bool ret = objComment.PostCommentAdd(FeedId, Text, objInstagramAccount.AccessToken);

            return "";

        
        }