public List <BasicUserInfo> GetAllPublicProfile() { using (var db = new SystemDBContext()) { // get all public profiles var profiles = db.Profiles.Where(x => x.IsPrivate == false).ToList(); var visibleUser = new List <BasicUserInfo>(); // get all friends var friendService = new FriendService(UserToken); visibleUser.AddRange(friendService.GetAllFriends()); foreach (var profile in profiles) { // not contained in visible user yet ( not friends ) if (visibleUser.FirstOrDefault(x => x.HashId == profile.UserHashId) == null) { // search for user and add info if exist var user = db.Users.FirstOrDefault(x => x.HashId == profile.UserHashId); if (user != null) { visibleUser.Add(new BasicUserInfo() { AreFriend = false, HashId = user.HashId, Username = user.Username }); } } } return(visibleUser); } }
/// <summary> /// Get all the maps of your friends /// </summary> /// <returns></returns> public List <MapModel> GetMyFriendsZones() { var friendService = new FriendService(UserToken); var friends = friendService.GetAllFriends(); var maps = new List <MapModel>(); foreach (var friend in friends) { maps.AddRange(GetUserMaps(friend.HashId)); } return(maps); }