/// <summary> /// Unlikes a post /// </summary> private void UnlikePosts() { Console.WriteLine("Unlike a post"); Post post = FindPost(); post.Unlike(); }
/// <summary> /// a method which Unlikes a psot /// </summary> private void UnlikePost() { ConsoleHelper.OutputTitle("Unliking a Post"); Post post = FindPost(); post.Unlike(); }
/// <summary> /// Unlike a post unless the user is the author of the post or /// has not already liked the post. /// </summary> private void UnlikePost(Post post) { if (Posts[VisiblePostIndex].Username == NetworkApp.CurrentUser) { RedAlert = " -- You cannot like your own posts --\n"; } else { if (Likes.Contains(VisiblePostIndex)) { post.Unlike(); BlueAlert = " -- You unliked this post --\n"; int like = Likes.FindIndex(x => x == VisiblePostIndex); Likes.RemoveAt(like); } else { RedAlert = " -- You have not liked this post yet --\n"; } } }
/// <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 "); } }
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"); } }
/// <summary> /// Take away a like from a post /// </summary> private void UnlikePost() { int id = (int)ConsoleHelper.InputNumber("\n\tPlease Enter The ID of the Post you wish to Unlike: "); Post post = news.FindPost(id); post.Unlike(); }
/// <summary> /// This function allows the user to unlike /// any existing post by inputing the ID /// </summary> private void UnlikePost() { int id = (int)ConsoleHelper.InputNumber(" Please enter " + "the ID of the Post you wish to Unlike > "); Post post = news.FindPost(id); post.Unlike(); ConsoleHelper.OutputTitle(" Post unliked"); }
public void UnlikePost(int id) { Post post = FindPost(id); if (post == null) { Console.WriteLine($"\nPost with ID number {id} doesn not exist"); } else { Console.WriteLine($"\nUnliked post ID {id}"); } post.Unlike(); }
/// <summary> /// Unlike a post based on the given id post /// </summary> public void UnlikePost(int id) { Post post = FindPost(id); if (post == null) { Console.WriteLine($"\nPost with ID: {id} does not exist!\n"); } else { Console.WriteLine($"\nYou have unliked the the following post {id}!\n"); post.Unlike(); post.Display(); } }
/// <summary> /// This is to like and unlike a post /// </summary> private void LikePost() { ConsoleHelper.OutputTitle("Like/Unlike post"); int id = (int)ConsoleHelper.InputNumber("Please enter the id of the post: "); Console.Write("Do you like this post yes/no: "); string awnser = Console.ReadLine(); if (awnser.StartsWith("y")) { Post post = news.FindPost(id); post.Like(); } else { Post post = news.FindPost(id); post.Unlike(); } }