public ActionResult Index(string screenName) { var service = new UserService(Token); var user = service.Load(screenName); var friendship = service.LoadFriendship(Token.ScreenName, screenName); if (user == null) { return NotFound(); } ViewData["user"] = user; ViewData["friendship"] = friendship; ViewData["isYou"] = Token.ScreenName.Equals(screenName, StringComparison.OrdinalIgnoreCase); Func<string> loadInitialData = () => new JavaScriptSerializer().Serialize(service.Statuses(screenName, null, null)); ViewData["loadInitialData"] = loadInitialData; ViewData["action"] = "user"; ViewData["loadMoreUrl"] = "/statuses/forUser/"; return View(); }
public JsonResult ForUser(string screenName, long? newerThan, long? olderThan) { var service = new UserService(Token); return StandardJsonResult(service, s => s.Statuses(screenName, newerThan, olderThan)); }
private ICollection<Status> UserTimeline(string participant) { ICollection<Status> statuses; if (_userTimelineCache.TryGetValue(participant, out statuses)) { return statuses; } calls++; statuses = new UserService(_currentUserToken).Statuses(participant, null, null); _userTimelineCache.Add(participant, statuses); foreach (var status in statuses) { if (!_statusCache.ContainsKey(status.Id)) { _statusCache.Add(status.Id, status); } } return statuses; }
public ActionResult Unfollow(string screenName) { var service = new UserService(Token); return StandardJsonResult(service, s => s.Unfollow(screenName)); }