コード例 #1
0
        public ActionResult Like(string id, string actn)
        {
            Likes lk = new Likes();

            actn = actn.ToLower();
            string result = string.Empty;

            if (actn == "like")
            {
                var s = lk.LikeMedia(id, HttpContext.User.Identity.Name);
                if (s.meta.code == "200")
                {
                    result = "liked";
                }
            }
            else if (actn == "unlike")
            {
                var s = lk.UnlikeMedia(id, HttpContext.User.Identity.Name);
                if (s.meta.code == "200")
                {
                    result = "unliked";
                }
            }

            return(Content(result));
        }
コード例 #2
0
        public ActionResult InstagramReturnUrl(string code)
        {
            InstagramAuth instagramAuth = new InstagramAuth();

            OuthUser user         = instagramAuth.GetAccessToken(code, instaConfig); // get user who loged in with an access_token
            string   access_token = user.access_token;


            Likes likes = new Likes();

            string idImage = "1476852486660100934_2015123882";

            likes.LikeMedia(idImage, access_token);

            return(View());
        }