Inheritance: BaseClient
Ejemplo n.º 1
0
 public ActionResult Index()
 {
     if (base.userToken != null) {
         UsersClient client = new UsersClient(userToken.access_token);
         try {
             ViewData["UserFeed"] = client.SelfFeed();
             return View(client.User(null).data);
         } catch { }
     }
     return View ();
 }
Ejemplo n.º 2
0
        public FriendsController()
            : base()
        {
            client = new UsersClient(base.userToken.access_token);

            List<SubNavItem> subNavItems = new List<SubNavItem>();
            subNavItems.Add(new SubNavItem { LinkText = "Following", ActionName = "Following", ControllerName="Friends" });
            subNavItems.Add(new SubNavItem { LinkText = "Followers", ActionName = "Followers", ControllerName="Friends" });

            ViewData["SubNavItems"] = subNavItems;
        }
Ejemplo n.º 3
0
        public ActionResult Next()
        {
            string next_max_id = RouteData.Values["id"] != null ? RouteData.Values["id"].ToString() : "";
            UsersClient client = new UsersClient(base.userToken.access_token);
            ApiResponse<FeedItem> media = client.RecentMedia(null, next_max_id, null);

            ViewData["PreviousPage"] = media.data[0].id;
            ViewData["Photos"] = media;

            return View("Index");
        }
Ejemplo n.º 4
0
        public PhotosController()
            : base()
        {
            client = new UsersClient(base.userToken.access_token);

            List<SubNavItem> subNavItems = new List<SubNavItem>();
            subNavItems.Add(new SubNavItem { LinkText = "Your feed", ActionName = "Index", ControllerName = "Home" });
            subNavItems.Add(new SubNavItem { LinkText = "Your photos", ActionName = "Index", ControllerName = "Photos" });
            subNavItems.Add(new SubNavItem { LinkText = "Popular photos", ActionName = "Popular", ControllerName = "Photos" });

            ViewData["SubNavItems"] = subNavItems;
        }
Ejemplo n.º 5
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);
        }