public ActionResult Chat(int id) { if (!User.Identity.IsAuthenticated) return RedirectToAction("Index", "FoursquareLogin"); ViewBag.to = id; FoursquareOAuth foursquareOAuth = new FoursquareOAuth(GetCurrentUserToken()); bool isFriend = foursquareOAuth.CheckForFriendship(id); ViewBag.isFriend = isFriend; ViewBag.token = GetCurrentUserToken(); return View(); }
public ActionResult Index() { if (Request["targetID"] == null) return HttpNotFound(); if (!User.Identity.IsAuthenticated) return RedirectToAction("Index", "FoursquareLogin"); int targetId = Convert.ToInt32(Request["targetID"]); FoursquareOAuth foursquareOAuth = new FoursquareOAuth(GetCurrentUserToken()); if (targetId == Convert.ToInt32(User.Identity.Name) || foursquareOAuth.CheckForFriendship(targetId)) { ViewBag.profile = GetProfileInfo(targetId); ViewBag.token = GetCurrentUserToken(); return View(); } return RedirectToAction("Index", "Foursquare"); }
public Profile GetProfile(string userId, string token, string targetId) { int uId = Convert.ToInt32(userId); int tId = Convert.ToInt32(targetId); if (AuthService.ValidateAuthData(uId, token)) { FoursquareUserContext dbContext = new FoursquareUserContext(); IMessageRepository repository = new MessageRepository(dbContext); FoursquareOAuth fsqOAuth = new FoursquareOAuth(token); if (fsqOAuth.CheckForFriendship(tId)) { Profile res = fsqOAuth.GetProfileInfo(tId); return res; } } return null; }