예제 #1
0
        /// <summary>
        /// Menu Choices of what to do once you have selected the comment option.
        /// </summary>
        /// <param name="post"></param>
        public void MenuChoices(Post post)
        {
            Console.WriteLine("\nWhat would you like to do");
            string[] choices = { "Like this post", "Unlike this post", "Comment on this post" };

            int choice = ConsoleHelper.SelectChoice(choices);

            if (choice == 1)
            {
                post.Like();
                Console.WriteLine("\nYour action has been recorded ");
            }
            else if (choice == 2)
            {
                post.Unlike();
                Console.WriteLine("\nYour action has been recorded ");
            }
            else if (choice == 3)
            {
                Console.WriteLine("What comment would you like to add to this post ");
                string comment = Console.ReadLine();

                post.AddComment(comment);

                Console.WriteLine("\nYour action has been recorded ");
            }
        }
예제 #2
0
        public void InteractOptions(Post post)
        {
            Console.WriteLine("1.Like the post\n");
            Console.WriteLine("2.Unlike the post\n");
            Console.WriteLine("3.Comment on the post\n");
            Console.Write("Which Options would you like to pick? > ");
            string value = Console.ReadLine();

            Option = Convert.ToInt32(value);


            if (Option == 1)
            {
                post.Like();
                Console.WriteLine("\nLiked!");
            }

            else if (Option == 2)
            {
                post.Unlike();
                Console.WriteLine("\nUnLiked!");
            }

            else if (Option == 3)
            {
                Console.Write("\nLeave a Comment > ");
                string comment = Console.ReadLine();

                post.AddComment(comment);

                Console.WriteLine("\nComment been added");
            }
        }
예제 #3
0
        /// <summary>
        /// Promts the user to enter a comment and adds it to a post.
        /// </summary>
        public static void AddComment(Post post)
        {
            Console.Write("\n    Enter comment > ");

            string text = Console.ReadLine();

            post.AddComment(text);

            BlueAlert = "\n    -- Comment added --\n";
        }
        /// <summary>
        /// to add said comment onto anypost
        /// </summary>
        private void AddComment()
        {
            ConsoleHelper.OutputTitle("Add a comment");
            int id = (int)ConsoleHelper.InputNumber("Now can you enter the id of post you want to comment on: ");

            Console.WriteLine("Please enter your comment: ");
            string comment = Console.ReadLine();
            Post   post    = news.FindPost(id);

            post.AddComment(comment);
        }
예제 #5
0
        /// <summary>
        /// where the user adds a Comment onto a post
        /// </summary>
        private void Comment()
        {
            Console.WriteLine("Comment on a Post");
            Post post = FindPost();

            post.Display();
            Console.WriteLine("Please Enter your Comment");
            string comment = Console.ReadLine();

            post.AddComment(comment);
        }
예제 #6
0
        /// <summary>
        /// a method to add a comment to a post
        /// </summary>
        private void AddComment()
        {
            ConsoleHelper.OutputTitle("Adding a Comment");
            Post post = FindPost();

            post.Display();

            Console.WriteLine("Enter Comment > ");
            string comment = Console.ReadLine();

            post.AddComment(comment);
        }
예제 #7
0
        /// <summary>
        /// Adds a comment
        /// </summary>
        private void AddComment()
        {
            Console.WriteLine("Add a comment to a post");
            Post post = FindPost();

            post.Display();

            Console.WriteLine("Enter your comment: ");
            string comment = Console.ReadLine();

            post.AddComment(comment);
        }
예제 #8
0
        public void AddComment(int id, string comment)
        {
            Post post = FindPost(id);

            if (post == null)
            {
                Console.WriteLine($"\nPost with ID number {id} doesn not exist");
            }
            else
            {
                Console.WriteLine($"\nComment added to post ID {id}");
                post.AddComment(comment);
            }
        }
예제 #9
0
        /// <summary>
        /// Add comments based on the post id
        /// then add text on the post
        /// </summary>
        public void AddPostComment(int id, string text)
        {
            Post post = FindPost(id);

            if (post == null)
            {
                Console.WriteLine($"\nPost with ID: {id} does not exist!\n");
            }
            else
            {
                Console.WriteLine($"\nThe following comment have been added to post {id}!\n");
                post.AddComment(text);
                post.Display();
            }
        }
예제 #10
0
        /// <summary>
        /// Adds a comment to a post with particular id
        /// </summary>
        /// <param name="id"></param>
        public void AddComment(int id)
        {
            Post post = FindPost(id);

            if (post == null)
            {
                Console.WriteLine("Post with id ", id, " does not exist.");
            }
            else
            {
                Console.WriteLine("Adding a comment...");
                Console.Write("Please enter your comment: ");
                string text = Console.ReadLine();
                post.AddComment(text);
            }
        }
예제 #11
0
        /// <summary>
        /// Add a comment to a post
        /// </summary>
        private void AddComment()
        {
            int  id   = (int)ConsoleHelper.InputNumber("\n\tPlease Enter The ID of the Post you wish to Comment on: ");
            Post post = news.FindPost(id);

            if (post != null)
            {
                Console.Write("\n\tPlease Enter Your Comment: ");
                string comment = Console.ReadLine();
                post.AddComment(comment);
            }
            else
            {
                Console.WriteLine("Post Number Does Not Exsist");
            }

            ConsoleHelper.OutputTitle("Comment Added");
        }
예제 #12
0
        /// <summary>
        /// This allows the user to add a comment
        /// on any existing post through inputing the ID
        /// </summary>
        private void AddComment()
        {
            int id = (int)ConsoleHelper.InputNumber(" Please enter " +
                                                    "the ID of the Post you wish to Comment on > ");
            Post post = news.FindPost(id);

            if (post != null)
            {
                Console.Write(" Please Enter Your Comment > ");
                string comment = Console.ReadLine();
                post.AddComment(comment);
            }
            else
            {
                Console.WriteLine(" This post does not exist");
            }

            ConsoleHelper.OutputTitle(" Comment Added");
        }
예제 #13
0
        /// <summary>
        /// Adds a comment to a post with a given ID and comment
        /// by the user.
        /// </summary>
        public void AddComment(int id, string comment)
        {
            Post post = FindPostById(id);

            if (post == null)
            {
                Console.WriteLine($"\n\tPost with ID {id} doesn't exist.");
            }
            else if (comment == "")
            {
                Console.WriteLine($"\n\tNo comment has been entered.");
            }
            else
            {
                Console.WriteLine("\n\tComment has been added to post with "
                                  + $"ID {id}\n");
                post.AddComment(comment);
                post.Display();
            }
        }