Esempio n. 1
0
        public void DeleteFriends(int profileId)
        {
            List <Friend> friends = new List <Friend>();

            foreach (Friend f in friendRepo.ByFromId(profileId, false))
            {
                friends.Add(f);
            }
            foreach (Friend f in friendRepo.ByFromId(profileId, true))
            {
                friends.Add(f);
            }
            foreach (Friend f in friendRepo.ByToId(profileId, false))
            {
                friends.Add(f);
            }
            foreach (Friend f in friendRepo.ByToId(profileId, true))
            {
                friends.Add(f);
            }

            if (friends.Count() == 0)
            {
                return;
            }

            foreach (Friend f in friends)
            {
                friendRepo.DeleteFriend(f);
            }
        }
Esempio n. 2
0
        /*
         *  Get list of friend requests to current user.
         */
        public List <int?> FriendRequests()
        {
            // Get list of unaccepted friend requests by the current user's ProfileID.
            IEnumerable <Friend> friends = friendRepo.ByToId(currentProfile.id, false);

            // Prep list for prepped profiles.
            List <int?> requests = new List <int?>();

            // If there were results,
            if (friends != null)
            {
                // prep each result and add to list of requests.
                foreach (Friend f in friends)
                {
                    requests.Add(f.FromId);
                }
            }

            // Return results to caller.
            return(requests);
        }