public ActionResult FacebookPages(string pageId) { ManagePageByUser aManagePageByUser = new ManagePageByUser(); //var client = new FacebookClient(accessToken); dynamic me = client.Get("me/accounts?fields=id,name,category"); var data = me["data"].ToString(); dynamic pageName = client.Get(pageId + "?fields=name,likes"); string pname = pageName.ToString(); JObject rss = JObject.Parse(pname); ViewBag.PageNameById = (string) rss.SelectToken("name"); ViewBag.PageLikesById = (int)rss.SelectToken("likes"); aManagePageByUser.pageList = JsonConvert.DeserializeObject<List<FacebookUserPage>>(data); try { ViewBag.PostsList = GetPage(pageId).postLists.ToList(); return View(aManagePageByUser); } catch (NullReferenceException exception) { ViewBag.PostsList = null; return View(aManagePageByUser); } }
public ActionResult FacebookPages() { ManagePageByUser aManagePageByUser = new ManagePageByUser(); //var client = new FacebookClient(accessToken); dynamic me = client.Get("me/accounts?fields=id,name,category"); var data = me["data"].ToString(); aManagePageByUser.pageList = JsonConvert.DeserializeObject<List<FacebookUserPage>>(data); return View(aManagePageByUser); }