public static Instagramaccounts GetInstagramUserDeatils(string profileId) { DatabaseRepository dbr = new DatabaseRepository(); Domain.Socioboard.Models.Instagramaccounts _InstagramUserDetails = dbr.Find <Domain.Socioboard.Models.Instagramaccounts>(t => t.InstagramId == profileId).FirstOrDefault(); return(_InstagramUserDetails); }
public static void CreateReports(string InstagramId, bool is90daysupdated) { int day = 1; if (!is90daysupdated) { day = 90; } List <Domain.Socioboard.Models.Mongo.InstagramFeed> lstGetVideoPosts = GetVideoPosts(InstagramId, day); List <Domain.Socioboard.Models.Mongo.InstagramFeed> lstGetImagePosts = GetImagePosts(InstagramId, day); Domain.Socioboard.Models.Instagramaccounts _InstagramUserDetails = GetInstagramUserDeatils(InstagramId); List <Domain.Socioboard.Models.Mongo.InstagramComment> lstGetInstagramPostComments = GetInstagramPostComments(InstagramId, day); List <Domain.Socioboard.Models.Mongo.InstagramPostLikes> lstGetInstagramPostLikes = GetInstagramPostLikes(InstagramId, day); List <Domain.Socioboard.Models.Mongo.MongoTwitterMessage> lstMongoTwitterMessage = GetInstagramFollwerFollowing(InstagramId, day); for (int i = 1; i < day; i++) { Domain.Socioboard.Models.Mongo.InstagramDailyReport _InstagramDailyReport = new Domain.Socioboard.Models.Mongo.InstagramDailyReport(); double since = SBHelper.ConvertToUnixTimestamp(new DateTime(DateTime.UtcNow.AddDays(-(i)).Year, DateTime.UtcNow.AddDays(-(i)).Month, DateTime.UtcNow.AddDays(-(i)).Day, 0, 0, 0, DateTimeKind.Utc)); double until = SBHelper.ConvertToUnixTimestamp(new DateTime(DateTime.UtcNow.AddDays(-i).Year, DateTime.UtcNow.AddDays(-i).Month, DateTime.UtcNow.AddDays(-i).Day, 23, 59, 59, DateTimeKind.Utc)); // lstGetVideoPosts = lstGetVideoPosts.Where(t => t.FeedDate <= until && t.FeedDate >= since).ToList(); //lstGetImagePosts= lstGetImagePosts.Where(t => t.FeedDate <= until && t.FeedDate >= since).ToList(); //lstGetInstagramPostComments= lstGetInstagramPostComments.Where(t => t.Created_Time <= until && t.Created_Time >= since).ToList(); //lstGetInstagramPostLikes= lstGetInstagramPostLikes.Where(t => t.Created_Date <= until && t.Created_Date >= since).ToList(); //lstMongoTwitterMessage= lstMongoTwitterMessage.Where(t => t.messageTimeStamp <= until && t.messageTimeStamp >= since).ToList(); _InstagramDailyReport.id = ObjectId.GenerateNewId(); _InstagramDailyReport.date = since; _InstagramDailyReport.followcount = Convert.ToInt64(lstMongoTwitterMessage.Count(t => t.messageTimeStamp <= until && t.messageTimeStamp >= since && t.type == Domain.Socioboard.Enum.TwitterMessageType.InstagramFollower)); _InstagramDailyReport.followingcount = Convert.ToInt64(lstMongoTwitterMessage.Count(t => t.messageTimeStamp <= until && t.messageTimeStamp >= since && t.type == Domain.Socioboard.Enum.TwitterMessageType.InstagramFollowing)); _InstagramDailyReport.fullName = _InstagramUserDetails.InsUserName; _InstagramDailyReport.imagepost = Convert.ToInt64(lstGetImagePosts.Count(t => t.FeedDate <= until && t.FeedDate >= since)); _InstagramDailyReport.instaName = _InstagramUserDetails.InsUserName; _InstagramDailyReport.mediaCount = Convert.ToInt64(lstGetVideoPosts.Count(t => t.FeedDate <= until && t.FeedDate >= since) + lstGetImagePosts.Count(t => t.FeedDate <= until && t.FeedDate >= since)); _InstagramDailyReport.postcomment = Convert.ToInt64(lstGetInstagramPostComments.Count(t => t.CommentDate <= until && t.CommentDate >= since)); _InstagramDailyReport.postlike = Convert.ToInt64(lstGetInstagramPostLikes.Count(t => t.Created_Date <= until && t.Created_Date >= since)); _InstagramDailyReport.profileId = _InstagramUserDetails.InstagramId; _InstagramDailyReport.videopost = Convert.ToInt64(lstGetVideoPosts.Count(t => t.FeedDate <= until && t.FeedDate >= since)); _InstagramDailyReport.profilePicUrl = _InstagramUserDetails.ProfileUrl; MongoRepository mongorepo = new MongoRepository("InstagramDailyReport"); var ret = mongorepo.Find <Domain.Socioboard.Models.Mongo.InstagramDailyReport>(t => t.date == _InstagramDailyReport.date && t.profileId == InstagramId); var task = Task.Run(async() => { return(await ret); }); int count = task.Result.Count; if (count < 1) { mongorepo.Add <Domain.Socioboard.Models.Mongo.InstagramDailyReport>(_InstagramDailyReport); } } }
public IActionResult AddProfileToGroup(string profileId, long groupId, long userId, Domain.Socioboard.Enum.SocialProfileType profileType) { DatabaseRepository dbr = new DatabaseRepository(_logger, _appEnv); List <Domain.Socioboard.Models.Groupprofiles> lstGroupProfiles = GroupProfilesRepository.getGroupProfiles(groupId, _redisCache, dbr); if (lstGroupProfiles.Where(t => t.profileId.Equals(profileId)).Count() > 0) { return(BadRequest("profile already added")); } else { Domain.Socioboard.Models.Groups grp = dbr.Find <Domain.Socioboard.Models.Groups>(t => t.id == groupId).FirstOrDefault(); if (grp == null) { return(BadRequest("Invalid groupId")); } else { Domain.Socioboard.Models.Groupprofiles grpProfile = new Domain.Socioboard.Models.Groupprofiles(); if (profileType == Domain.Socioboard.Enum.SocialProfileType.Facebook || profileType == Domain.Socioboard.Enum.SocialProfileType.FacebookFanPage || profileType == Domain.Socioboard.Enum.SocialProfileType.FacebookPublicPage) { Domain.Socioboard.Models.Facebookaccounts fbAcc = Repositories.FacebookRepository.getFacebookAccount(profileId, _redisCache, dbr); if (fbAcc == null) { return(BadRequest("Invalid profileId")); } if (fbAcc.UserId != userId) { return(BadRequest("profile is added by other user")); } grpProfile.profileName = fbAcc.FbUserName; grpProfile.profileOwnerId = userId; grpProfile.profilePic = "http://graph.facebook.com/" + fbAcc.FbUserId + "/picture?type=small"; grpProfile.profileType = profileType; } else if (profileType == Domain.Socioboard.Enum.SocialProfileType.Twitter) { Domain.Socioboard.Models.TwitterAccount twtAcc = Repositories.TwitterRepository.getTwitterAccount(profileId, _redisCache, dbr); if (twtAcc == null) { return(BadRequest("Invalid profileId")); } if (twtAcc.userId != userId) { return(BadRequest("profile is added by other user")); } grpProfile.profileName = twtAcc.twitterScreenName; grpProfile.profileOwnerId = userId; grpProfile.profilePic = twtAcc.profileImageUrl; grpProfile.profileType = Domain.Socioboard.Enum.SocialProfileType.Twitter; } else if (profileType == Domain.Socioboard.Enum.SocialProfileType.GPlus) { Domain.Socioboard.Models.Googleplusaccounts gplusAccount = Repositories.GplusRepository.getGPlusAccount(profileId, _redisCache, dbr); if (gplusAccount == null) { return(BadRequest("Invalid ProfileId")); } if (gplusAccount.UserId != userId) { return(BadRequest("profile is added by other user")); } grpProfile.profileName = gplusAccount.GpUserName; grpProfile.profileOwnerId = userId; grpProfile.profilePic = gplusAccount.GpProfileImage; } else if (profileType == Domain.Socioboard.Enum.SocialProfileType.GoogleAnalytics) { Domain.Socioboard.Models.GoogleAnalyticsAccount gplusAccount = Repositories.GplusRepository.getGAAccount(profileId, _redisCache, dbr); if (gplusAccount == null) { return(BadRequest("Invalid ProfileId")); } if (gplusAccount.UserId != userId) { return(BadRequest("profile is added by other user")); } grpProfile.profileName = gplusAccount.GaProfileName; grpProfile.profileOwnerId = userId; grpProfile.profilePic = gplusAccount.ProfilePicUrl; } else if (profileType == Domain.Socioboard.Enum.SocialProfileType.Instagram) { Domain.Socioboard.Models.Instagramaccounts _Instagramaccounts = Repositories.InstagramRepository.getInstagramAccount(profileId, _redisCache, dbr); if (_Instagramaccounts == null) { return(BadRequest("Invalid ProfileId")); } if (_Instagramaccounts.UserId != userId) { return(BadRequest("profile is added by other user")); } grpProfile.profileName = _Instagramaccounts.InsUserName; grpProfile.profileOwnerId = userId; grpProfile.profilePic = _Instagramaccounts.ProfileUrl; } else if (profileType == Domain.Socioboard.Enum.SocialProfileType.LinkedIn) { Domain.Socioboard.Models.LinkedInAccount _LinkedInAccount = Repositories.LinkedInAccountRepository.getLinkedInAccount(profileId, _redisCache, dbr); if (_LinkedInAccount == null) { return(BadRequest("Invalid ProfileId")); } if (_LinkedInAccount.UserId != userId) { return(BadRequest("profile is added by other user")); } grpProfile.profileName = _LinkedInAccount.LinkedinUserName; grpProfile.profileOwnerId = userId; grpProfile.profilePic = _LinkedInAccount.ProfileImageUrl; } else if (profileType == Domain.Socioboard.Enum.SocialProfileType.LinkedInComapanyPage) { Domain.Socioboard.Models.LinkedinCompanyPage _LinkedInAccount = Repositories.LinkedInAccountRepository.getLinkedinCompanyPage(profileId, _redisCache, dbr); if (_LinkedInAccount == null) { return(BadRequest("Invalid ProfileId")); } if (_LinkedInAccount.UserId != userId) { return(BadRequest("profile is added by other user")); } grpProfile.profileName = _LinkedInAccount.LinkedinPageName; grpProfile.profileOwnerId = userId; grpProfile.profilePic = _LinkedInAccount.LogoUrl; } else if (profileType == Domain.Socioboard.Enum.SocialProfileType.YouTube) { Domain.Socioboard.Models.YoutubeChannel _YoutubeChannel = Repositories.GplusRepository.getYTChannel(profileId, _redisCache, dbr); if (_YoutubeChannel == null) { return(BadRequest("Invalid ProfileId")); } if (_YoutubeChannel.UserId != userId) { return(BadRequest("profile is added by other user")); } grpProfile.profileName = _YoutubeChannel.YtubeChannelName; grpProfile.profileOwnerId = userId; grpProfile.profilePic = _YoutubeChannel.ChannelpicUrl; } if (profileType == Domain.Socioboard.Enum.SocialProfileType.Pinterest) { Domain.Socioboard.Models.PinterestAccount pinAcc = dbr.Find <Domain.Socioboard.Models.PinterestAccount>(t => t.username.Equals(profileId)).FirstOrDefault(); if (pinAcc == null) { return(BadRequest("Invalid profileId")); } if (pinAcc.userid != userId) { return(BadRequest("profile is added by other user")); } grpProfile.profileName = pinAcc.firstname + " " + pinAcc.lastname; grpProfile.profileOwnerId = userId; grpProfile.profilePic = pinAcc.profileimgaeurl; grpProfile.profileType = profileType; } grpProfile.entryDate = DateTime.UtcNow; grpProfile.groupId = grp.id; grpProfile.profileId = profileId; grpProfile.profileType = profileType; dbr.Add <Domain.Socioboard.Models.Groupprofiles>(grpProfile); //codes to clear cache _redisCache.Delete(Domain.Socioboard.Consatants.SocioboardConsts.CacheGroupProfiles + groupId); //end codes to clear cache return(Ok("Added Successfully")); } } }
public static List <Domain.Socioboard.Models.profilesdetail> getTop3GroupProfiles(long groupId, Helper.Cache _redisCache, Model.DatabaseRepository dbr) { //try //{ // List<Domain.Socioboard.Models.Groupprofiles> inMemGroupProfiles = _redisCache.Get<List<Domain.Socioboard.Models.Groupprofiles>>(Domain.Socioboard.Consatants.SocioboardConsts.CacheGroupProfiles + groupId); // if (inMemGroupProfiles != null) // { // return inMemGroupProfiles; // } //} //catch { } //Domain.Socioboard.Models.profilesdetail profiledetails = new profilesdetail(); List <Domain.Socioboard.Models.profilesdetail> lstprofiledetail = new List <profilesdetail>(); List <Domain.Socioboard.Models.Groupprofiles> groupProfiles = dbr.FindWithRange <Domain.Socioboard.Models.Groupprofiles>(t => t.groupId == groupId, 0, 3).ToList(); // _redisCache.Set(Domain.Socioboard.Consatants.SocioboardConsts.CacheGroupProfiles + groupId, groupProfiles); // List<Domain.Socioboard.Models.Groupprofiles> groupProfiless = groupProfiles.Take(3).ToList(); foreach (Domain.Socioboard.Models.Groupprofiles profile in groupProfiles) { if (profile.profileType == Domain.Socioboard.Enum.SocialProfileType.Facebook) { Domain.Socioboard.Models.Facebookaccounts fbAcc = Repositories.FacebookRepository.getFacebookAccount(profile.profileId, _redisCache, dbr); Domain.Socioboard.Models.profilesdetail profiledetails = new profilesdetail(); profiledetails.Fbaccount = fbAcc; lstprofiledetail.Add(profiledetails); } else if (profile.profileType == Domain.Socioboard.Enum.SocialProfileType.FacebookFanPage) { Domain.Socioboard.Models.Facebookaccounts fbpageAcc = Repositories.FacebookRepository.getFacebookAccount(profile.profileId, _redisCache, dbr); Domain.Socioboard.Models.profilesdetail profiledetails = new profilesdetail(); profiledetails.Fbaccount = fbpageAcc; lstprofiledetail.Add(profiledetails); } else if (profile.profileType == Domain.Socioboard.Enum.SocialProfileType.Twitter) { Domain.Socioboard.Models.TwitterAccount twtAcc = Repositories.TwitterRepository.getTwitterAccount(profile.profileId, _redisCache, dbr); Domain.Socioboard.Models.profilesdetail profiledetails = new profilesdetail(); profiledetails.Twtaccount = twtAcc; lstprofiledetail.Add(profiledetails); } else if (profile.profileType == Domain.Socioboard.Enum.SocialProfileType.Instagram) { Domain.Socioboard.Models.Instagramaccounts insAcc = Repositories.InstagramRepository.getInstagramAccount(profile.profileId, _redisCache, dbr); Domain.Socioboard.Models.profilesdetail profiledetails = new profilesdetail(); profiledetails.Instaaccount = insAcc; lstprofiledetail.Add(profiledetails); } else if (profile.profileType == Domain.Socioboard.Enum.SocialProfileType.GPlus) { Domain.Socioboard.Models.Googleplusaccounts gPlusAcc = Repositories.GplusRepository.getGPlusAccount(profile.profileId, _redisCache, dbr); Domain.Socioboard.Models.profilesdetail profiledetails = new profilesdetail(); profiledetails.Gplusaccount = gPlusAcc; lstprofiledetail.Add(profiledetails); } else if (profile.profileType == Domain.Socioboard.Enum.SocialProfileType.LinkedIn) { Domain.Socioboard.Models.LinkedInAccount linkdAcc = Repositories.LinkedInAccountRepository.getLinkedInAccount(profile.profileId, _redisCache, dbr); Domain.Socioboard.Models.profilesdetail profiledetails = new profilesdetail(); profiledetails.LinkdInaccount = linkdAcc; lstprofiledetail.Add(profiledetails); } else if (profile.profileType == Domain.Socioboard.Enum.SocialProfileType.LinkedInComapanyPage) { Domain.Socioboard.Models.LinkedinCompanyPage LinkedcompanyAcc = Repositories.LinkedInAccountRepository.getLinkedinCompanyPage(profile.profileId, _redisCache, dbr); Domain.Socioboard.Models.profilesdetail profiledetails = new profilesdetail(); profiledetails.LinkdINcompanyaccount = LinkedcompanyAcc; lstprofiledetail.Add(profiledetails); } else if (profile.profileType == Domain.Socioboard.Enum.SocialProfileType.YouTube) { Domain.Socioboard.Models.YoutubeChannel YTChnl = Repositories.GplusRepository.getYTChannel(profile.profileId, _redisCache, dbr); Domain.Socioboard.Models.profilesdetail profiledetails = new profilesdetail(); profiledetails.Ytubeaccount = YTChnl; lstprofiledetail.Add(profiledetails); } else if (profile.profileType == Domain.Socioboard.Enum.SocialProfileType.GoogleAnalytics) { Domain.Socioboard.Models.GoogleAnalyticsAccount gAAcc = Repositories.GplusRepository.getGAAccount(profile.profileId, _redisCache, dbr); Domain.Socioboard.Models.profilesdetail profiledetails = new profilesdetail(); profiledetails.GAaccount = gAAcc; lstprofiledetail.Add(profiledetails); } else if (profile.profileType == Domain.Socioboard.Enum.SocialProfileType.Pinterest) { Domain.Socioboard.Models.PinterestAccount PinAcc = Repositories.PinterestRepository.getPinterestAccountDetail(profile.profileId, _redisCache, dbr); Domain.Socioboard.Models.profilesdetail profiledetails = new profilesdetail(); profiledetails.Pintrestaccount = PinAcc; lstprofiledetail.Add(profiledetails); } //lstprofiledetail.Add(profiledetails); } return(lstprofiledetail); }
public static List <Domain.Socioboard.Models.profilesdetail> SearchProfileType(long groupId, string Profiletype, Helper.Cache _redisCache, Model.DatabaseRepository dbr) { try { List <Domain.Socioboard.Models.Groupprofiles> inMemGroupProfiles = _redisCache.Get <List <Domain.Socioboard.Models.Groupprofiles> >(Domain.Socioboard.Consatants.SocioboardConsts.CacheGroupProfiles + groupId); if (inMemGroupProfiles != null) { // return inMemGroupProfiles; } } catch { } List <Domain.Socioboard.Models.profilesdetail> lstprofiledetail = new List <profilesdetail>(); { if (Profiletype == "Facebook") { List <Domain.Socioboard.Models.Groupprofiles> FbProfiles = dbr.Find <Domain.Socioboard.Models.Groupprofiles>(t => t.groupId == groupId && t.profileType == Domain.Socioboard.Enum.SocialProfileType.Facebook).ToList(); foreach (Domain.Socioboard.Models.Groupprofiles profil in FbProfiles) { Domain.Socioboard.Models.Facebookaccounts fbAcc = Repositories.FacebookRepository.getFacebookAccount(profil.profileId, _redisCache, dbr); Domain.Socioboard.Models.profilesdetail profiledetails = new profilesdetail(); profiledetails.Fbaccount = fbAcc; lstprofiledetail.Add(profiledetails); } } else if (Profiletype == "FacebookPage") { List <Domain.Socioboard.Models.Groupprofiles> Fbpage = dbr.Find <Domain.Socioboard.Models.Groupprofiles>(t => t.groupId == groupId && t.profileType == Domain.Socioboard.Enum.SocialProfileType.FacebookFanPage).ToList(); foreach (Domain.Socioboard.Models.Groupprofiles page in Fbpage) { Domain.Socioboard.Models.Facebookaccounts fbpageAcc = Repositories.FacebookRepository.getFacebookAccount(page.profileId, _redisCache, dbr); Domain.Socioboard.Models.profilesdetail profiledetails = new profilesdetail(); profiledetails.Fbaccount = fbpageAcc; lstprofiledetail.Add(profiledetails); } } else if (Profiletype == "twitter") { List <Domain.Socioboard.Models.Groupprofiles> TwitterProfiles = dbr.Find <Domain.Socioboard.Models.Groupprofiles>(t => t.groupId == groupId && t.profileType == Domain.Socioboard.Enum.SocialProfileType.Twitter).ToList(); foreach (Domain.Socioboard.Models.Groupprofiles Twitter in TwitterProfiles) { Domain.Socioboard.Models.TwitterAccount twtAcc = Repositories.TwitterRepository.getTwitterAccount(Twitter.profileId, _redisCache, dbr); Domain.Socioboard.Models.profilesdetail profiledetails = new profilesdetail(); profiledetails.Twtaccount = twtAcc; lstprofiledetail.Add(profiledetails); } } else if (Profiletype == "instagram") { List <Domain.Socioboard.Models.Groupprofiles> InstagramProfiles = dbr.Find <Domain.Socioboard.Models.Groupprofiles>(t => t.groupId == groupId && t.profileType == Domain.Socioboard.Enum.SocialProfileType.Instagram).ToList(); foreach (Domain.Socioboard.Models.Groupprofiles Instagram in InstagramProfiles) { Domain.Socioboard.Models.Instagramaccounts insAcc = Repositories.InstagramRepository.getInstagramAccount(Instagram.profileId, _redisCache, dbr); Domain.Socioboard.Models.profilesdetail profiledetails = new profilesdetail(); profiledetails.Instaaccount = insAcc; lstprofiledetail.Add(profiledetails); } } else if (Profiletype == "googlepluse") { List <Domain.Socioboard.Models.Groupprofiles> GPlusProfiles = dbr.Find <Domain.Socioboard.Models.Groupprofiles>(t => t.groupId == groupId && t.profileType == Domain.Socioboard.Enum.SocialProfileType.GPlus).ToList(); foreach (Domain.Socioboard.Models.Groupprofiles GPlus in GPlusProfiles) { Domain.Socioboard.Models.Googleplusaccounts gPlusAcc = Repositories.GplusRepository.getGPlusAccount(GPlus.profileId, _redisCache, dbr); Domain.Socioboard.Models.profilesdetail profiledetails = new profilesdetail(); profiledetails.Gplusaccount = gPlusAcc; lstprofiledetail.Add(profiledetails); } } else if (Profiletype == "linkedin") { List <Domain.Socioboard.Models.Groupprofiles> LinkedInProfiles = dbr.Find <Domain.Socioboard.Models.Groupprofiles>(t => t.groupId == groupId && t.profileType == Domain.Socioboard.Enum.SocialProfileType.LinkedIn).ToList(); foreach (Domain.Socioboard.Models.Groupprofiles LinkedIn in LinkedInProfiles) { Domain.Socioboard.Models.LinkedInAccount linkdAcc = Repositories.LinkedInAccountRepository.getLinkedInAccount(LinkedIn.profileId, _redisCache, dbr); Domain.Socioboard.Models.profilesdetail profiledetails = new profilesdetail(); profiledetails.LinkdInaccount = linkdAcc; lstprofiledetail.Add(profiledetails); } } else if (Profiletype == "linkedincompanypage") { List <Domain.Socioboard.Models.Groupprofiles> LinkedInComapanyPageProfiles = dbr.Find <Domain.Socioboard.Models.Groupprofiles>(t => t.groupId == groupId && t.profileType == Domain.Socioboard.Enum.SocialProfileType.LinkedInComapanyPage).ToList(); foreach (Domain.Socioboard.Models.Groupprofiles LinkedInComapanyPage in LinkedInComapanyPageProfiles) { Domain.Socioboard.Models.LinkedinCompanyPage LinkedcompanyAcc = Repositories.LinkedInAccountRepository.getLinkedinCompanyPage(LinkedInComapanyPage.profileId, _redisCache, dbr); Domain.Socioboard.Models.profilesdetail profiledetails = new profilesdetail(); profiledetails.LinkdINcompanyaccount = LinkedcompanyAcc; lstprofiledetail.Add(profiledetails); } } else if (Profiletype == "Youtube") { List <Domain.Socioboard.Models.Groupprofiles> YouTubeProfiles = dbr.Find <Domain.Socioboard.Models.Groupprofiles>(t => t.groupId == groupId && t.profileType == Domain.Socioboard.Enum.SocialProfileType.YouTube).ToList(); foreach (Domain.Socioboard.Models.Groupprofiles YouTube in YouTubeProfiles) { Domain.Socioboard.Models.YoutubeChannel YTChnl = Repositories.GplusRepository.getYTChannel(YouTube.profileId, _redisCache, dbr); Domain.Socioboard.Models.profilesdetail profiledetails = new profilesdetail(); profiledetails.Ytubeaccount = YTChnl; lstprofiledetail.Add(profiledetails); } } else if (Profiletype == "GAnalytics") { List <Domain.Socioboard.Models.Groupprofiles> GoogleAnalyticsProfiles = dbr.Find <Domain.Socioboard.Models.Groupprofiles>(t => t.groupId == groupId && t.profileType == Domain.Socioboard.Enum.SocialProfileType.GoogleAnalytics).ToList(); foreach (Domain.Socioboard.Models.Groupprofiles GoogleAnalytics in GoogleAnalyticsProfiles) { Domain.Socioboard.Models.GoogleAnalyticsAccount gAAcc = Repositories.GplusRepository.getGAAccount(GoogleAnalytics.profileId, _redisCache, dbr); Domain.Socioboard.Models.profilesdetail profiledetails = new profilesdetail(); profiledetails.GAaccount = gAAcc; lstprofiledetail.Add(profiledetails); } } else if (Profiletype == "Pinterest") { List <Domain.Socioboard.Models.Groupprofiles> PinterestProfiles = dbr.Find <Domain.Socioboard.Models.Groupprofiles>(t => t.groupId == groupId && t.profileType == Domain.Socioboard.Enum.SocialProfileType.Pinterest).ToList(); foreach (Domain.Socioboard.Models.Groupprofiles Pinterest in PinterestProfiles) { Domain.Socioboard.Models.PinterestAccount PinAcc = Repositories.PinterestRepository.getPinterestAccountDetail(Pinterest.profileId, _redisCache, dbr); Domain.Socioboard.Models.profilesdetail profiledetails = new profilesdetail(); profiledetails.Pintrestaccount = PinAcc; lstprofiledetail.Add(profiledetails); } } return(lstprofiledetail); } }