public string FindFacebookProfiles(string searchText) { try { //Process authorization if (!ProcessAuthorization(HttpContext.Current)) { AccessDenied(HttpContext.Current); return(null); } FacebookApiInfo apiInfo = FacebookApiHelper.GetFacebookApiInfoForCurrentUser(); if (apiInfo == null) { throw new SocialMediaAccountNotFound(SocialMediaResource.SocialMediaAccountNotFoundFacebook); } FacebookDataProvider facebookProvider = new FacebookDataProvider(apiInfo); List <FacebookUserInfo> users = facebookProvider.FindUsers(searchText); string result = JsonConvert.SerializeObject(users); return(result); } catch (Exception ex) { throw ProcessError(ex, "FindTwitterProfiles"); } }
public string FindUsers(string searchText, string socialNetwork) { try { //Process authorization if (!ProcessAuthorization(HttpContext.Current)) { AccessDenied(HttpContext.Current); return(null); } if (socialNetwork.ToLower() == "twitter") { TwitterDataProvider provider = new TwitterDataProvider(TwitterApiHelper.GetTwitterApiInfoForCurrentUser()); List <TwitterUserInfo> users = provider.FindUsers(searchText); return(GetTwitterUserListPage(users)); } if (socialNetwork.ToLower() == "facebook") { FacebookApiInfo apiInfo = FacebookApiHelper.GetFacebookApiInfoForCurrentUser(); if (apiInfo == null) { throw new SocialMediaAccountNotFound(SocialMediaResource.SocialMediaAccountNotFoundFacebook); } FacebookDataProvider facebookProvider = new FacebookDataProvider(apiInfo); List <FacebookUserInfo> users = facebookProvider.FindUsers(searchText); return(GetFacebookUserListPage(users)); } return(null); } catch (Exception ex) { throw ProcessError(ex, "FindUsers"); } }