Inheritance: BaseClient
Exemplo n.º 1
0
        public JsonResult Delete(FeedItem feedItem)
        {
            try {
                MediaClient client = new MediaClient(base.userToken.access_token);
                ApiSingleResponse<string> response = client.UnLike(feedItem.id);

                return Json(new { success = true });
            } catch { return Json(new { success = false }); }
        }
        //
        // GET: /Comment/Details/5
        public ActionResult Details(int id)
        {
            MediaClient client = new MediaClient(base.userToken.access_token);
            ApiSingleResponse<FeedItem> media = client.Media(id.ToString());

            ViewData["PhotoDetails"] = media.data;

            return PartialView("PhotoDetails", media.data);
        }
        public JsonResult Create(PhotoComment comment)
        {
            try {
                MediaClient client = new MediaClient(base.userToken.access_token);
                ApiSingleResponse<Comment> response = client.Comment(comment.id, Server.UrlEncode(comment.text));

                return Json(new { success = true });
            } catch { return Json(new { success = false }); }
        }
Exemplo n.º 4
0
        public ActionResult Popular()
        {
            try {

                MediaClient mediaClient = new MediaClient(base.userToken.access_token);
                ApiResponse<FeedItem> popular = mediaClient.Popular(EnvironmentHelpers.GetConfigValue("ClientId"));

                ViewData["Photos"] = popular.data;
            } catch { }

            return View();
        }
Exemplo n.º 5
0
        public ActionResult Details()
        {
            object mediaId;
            RouteData.Values.TryGetValue("id", out mediaId);

            try {
                MediaClient mediaClient = new MediaClient(userToken.access_token);
                ViewData["PhotoDetails"] = mediaClient.Media(mediaId.ToString()).data;

            } catch (System.Net.WebException ex) {
                ViewData["Error"] = ex.Message;
            }

            return View();
        }
Exemplo n.º 6
0
        protected override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            try {
                if (userToken != null) {
                    UsersClient client = new UsersClient(userToken.access_token);
                    ApiResponse<FeedItem> recentMedia = client.RecentMedia(null, null, null);

                    ViewData["UserData"] = client.User(null).data;

                    if (recentMedia != null) {
                        ViewData["RecentMedia"] = recentMedia.data.Take(6).ToList();
                        ViewData["Following"] = client.Follows(null).data.Take(12).ToList();
                        ViewData["FollowedBy"] = client.FollowedBy(null).data.Take(12).ToList();
                    }
                } else {
                    MediaClient mediaClient = new MediaClient("");
                    ViewData["Popular"] = mediaClient.Popular(EnvironmentHelpers.GetConfigValue("ClientId")).data;
                    ViewData["Authenticated"] = "false";
                }
            } catch { }

            base.OnActionExecuting(filterContext);
        }