예제 #1
0
        public void SearchUsers()
        {
            Console.Clear();

            Title("Search for Users");
            string       key   = JHelper.InputString("Enter Search Key: ");
            IList <User> users = Logic.SearchUser(key);

            while (true)
            {
                Console.Clear();
                Title($"Search Results for \"{key}\"");

                // Display list of users
                DisplayEnumeratedList(users, e => e.Name);
                Console.Write(bar());

                int userNumber = JHelper.InputInt("Enter Number (-1 to go Back): ", validator: e => e == -1 || (e > 0 && e <= users.Count));
                if (userNumber == -1)
                {
                    break;
                }
                UserProfile(users[userNumber - 1]);
            }
        }
예제 #2
0
        public void SeeRecommendedUsers()
        {
            while (true)
            {
                IList <User> users = Logic.GetRecommendedUsers().ToList();

                Console.Clear();

                Title("Recommended Users");

                // Display Users
                Console.WriteLine("Select Recommended User:"******"\n    Communities in Common: " + string.Join(", ", Logic.CommonCommunities(e).Take(3).Select(f => f.Name)));
                Console.WriteLine("[-1] Go Back");
                Console.Write(bar());

                int userNumber = JHelper.InputInt("Enter Number: ", validator: e => e == -1 || (e > 0 && e <= users.Count));
                if (userNumber == -1)
                {
                    break;
                }
                UserProfile(users[userNumber - 1]);
            }
        }
예제 #3
0
        public void SeeCommunities()
        {
            while (true)
            {
                var communities = Logic.GetCommunities().ToList();
                Console.Clear();

                Title("Communities");

                DisplayEnumeratedList(communities, e => e.Name);
                Console.Write(bar());

                int communityNumber = JHelper.InputInt("Enter Number (-1 to go Back): ", validator: e => e == -1 || (e > 0 && e <= communities.Count));
                if (communityNumber == -1)
                {
                    break;
                }
                SeeCommunityPosts(communities[communityNumber - 1]);
            }
        }
예제 #4
0
        private void SeeFollowedCommunities(User user)
        {
            while (true)
            {
                IList <Community> followedCommunities = user.Communities.Inorder().ToList();
                Console.Clear();

                Title($"Communities Joined by {user.Name}");

                // Dispay List of Communities
                DisplayEnumeratedList(followedCommunities, e => e.Name);

                Console.Write(bar());
                int userNumber = JHelper.InputInt("Enter Number (-1 to go Back): ", validator: e => e == -1 || (e > 0 && e <= followedCommunities.Count));
                if (userNumber == -1)
                {
                    break;
                }
                SeeCommunityPosts(followedCommunities[userNumber - 1]);
            }
        }
예제 #5
0
        public void SeeFollowedUsers(User user)
        {
            IList <User> followedUsers = user.FollowedUsers.ToList();

            while (true)
            {
                Console.Clear();

                Title($"Users Followed by {user.Name}");

                // Dispay List of Users
                DisplayEnumeratedList(followedUsers, e => e.Name);
                Console.Write(bar());
                // Input Selection
                int userNumber = JHelper.InputInt("Enter Number (-1 to go Back): ", validator: e => e == -1 || (e > 0 && e <= followedUsers.Count));
                if (userNumber == -1)
                {
                    break;
                }
                UserProfile(followedUsers[userNumber - 1]);
            }
        }
예제 #6
0
        public void SeeFollowedCommunities()
        {
            while (true)
            {
                Console.Clear();
                IList <Community> followedCommunities = Logic.FollowedCommunities().ToList();

                Title($"Followed Communities");

                // Dispay List of Communities
                DisplayEnumeratedList(followedCommunities, e => e.Name);
                Console.WriteLine("[-1] Go Back");
                Console.Write(bar());
                // Input Selection

                int userNumber = JHelper.InputInt("Enter Number: ", validator: e => e == -1 || (e > 0 && e <= followedCommunities.Count));
                if (userNumber == -1)
                {
                    break;
                }
                SeeCommunityPosts(followedCommunities[userNumber - 1]);
            }
        }
예제 #7
0
        private void CreatePost()
        {
            Console.Clear();

            Title("Create Post");

            IList <Community> communities = Logic.GetFolowedCommunities().ToList();

            // Display Communities
            DisplayEnumeratedList(communities, e => e.Name);
            Console.WriteLine("[-1] Go Back");

            Console.Write(bar());
            // Input Community
            int communityNumber = JHelper.InputInt("Enter Number: ", validator: e => e == -1 || (e > 0 && e <= communities.Count));

            if (communityNumber == -1)
            {
                return;
            }
            var community = communities[communityNumber - 1];

            PostToCommunity(community);
        }