private void RemovePost() { ConsoleHelper.OutputTitle($"Removing a Post"); int id = (int)ConsoleHelper.InputNumber(" Please enter the post id >", 1, Post.GetNumberOfPosts()); news.RemovePost(id); }
/// <summary> /// The user can remove a post that they made /// by using the post ID number. /// </summary> private void RemovePost() { ConsoleHelper.OutputHeading($"Select a post to remove"); int id = (int)ConsoleHelper.InputNumber(" Please enter the post Id > ", 1, Post.GetNumberOfPosts()); news.RemovePost(id); }
/// <summary> /// Prompts the user to add a comment to a post, first /// asking for the post's ID and then a comment. /// </summary> private void AddComment() { ConsoleHelper.OutputTitle("Adding a Comment"); int id = (int)ConsoleHelper.InputNumber("\tPlease enter " + "the post's ID > ", 1, Post.GetNumberOfPosts()); Console.Write("\tPlease enter a comment for this post > "); string comment = Console.ReadLine(); news.AddComment(id, comment); }
/// <summary> /// Like or unlike a post. Ask use for ID number of post /// </summary> private void LikeOrUnlikePost() { ConsoleHelper.OutputTitle("** LIKE OR UNLIKE A POST **"); // TODO: Display a list of posts with ID's before choosing? Console.Write(" # Would you like to (1) Like or (2) unlike a post?: "); string likeOrUnlike = Console.ReadLine(); if (likeOrUnlike == "1") { int id = (int)ConsoleHelper.InputNumber(" # Please enter the post ID to add a like: ", 1, Post.GetNumberOfPosts()); news.AddLike(id); } else if (likeOrUnlike == "2") { int id = (int)ConsoleHelper.InputNumber(" # Please enter the post ID to add a unlike: ", 1, Post.GetNumberOfPosts()); news.UnlikePost(id); } }
/// <summary> /// Add a comment to a post. Ask user for ID number of comment /// </summary> private void AddComment() { //throw new NotImplementedException(); ConsoleHelper.OutputTitle("** ADD COMMENT **"); int id = (int)ConsoleHelper.InputNumber(" # Please enter the post ID to add a comment: ", 1, Post.GetNumberOfPosts()); Console.Write(" # Please enter your comment: "); string comment = Console.ReadLine(); news.AddComment(id, comment); }
/// <summary> /// Delete a post from the system. Get a number from the /// user by using the ConsoleHelper class /// </summary> private void RemovePost() { ConsoleHelper.OutputTitle("** REMOVE A POST **"); int id = (int)ConsoleHelper.InputNumber(" # Please enter the post ID to delete: ", 1, Post.GetNumberOfPosts()); news.RemovePost(id); }
/// <summary> /// Like or unlike a post /// based on the post id /// </summary> private void LikePosts() { ConsoleHelper.OuputTitle("Like or Unlike a Post"); int id = (int)ConsoleHelper.InputNumber("Please enter the post id > ", 1, Post.GetNumberOfPosts()); Console.WriteLine("Do you want to [like] or [unlike] the post? > "); string choices = Console.ReadLine(); switch (choices) { case "like": Console.WriteLine("Like a Post\n"); news.LikePost(id); break; case "unlike": Console.WriteLine("Unlike a Post\n"); news.UnlikePost(id); break; default: Console.WriteLine("Invalid choice. Try Again."); LikePosts(); break; } }
/// <summary> /// Add comment to a post /// based on the post id /// </summary> private void AddComment() { ConsoleHelper.OuputTitle("Add a comment to a Post"); int id = (int)ConsoleHelper.InputNumber("Please enter the post id > ", 1, Post.GetNumberOfPosts()); Console.WriteLine("Enter the comment you want to add > "); string comment = Console.ReadLine(); news.AddPostComment(id, comment); }