/// <summary> /// a method which likes a post /// </summary> private void LikePost() { ConsoleHelper.OutputTitle("Liking a Post"); Post post = FindPost(); post.Like(); }
/// <summary> /// Likes a post /// </summary> private void LikePosts() { Console.WriteLine("Like a post"); Post post = FindPost(); post.Like(); }
/// <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> /// Add a like to a post /// </summary> private void LikePost() { int id = (int)ConsoleHelper.InputNumber("\n\tPlease Enter The ID of the Post you wish to Like: "); Post post = news.FindPost(id); post.Like(); }
public void AddLike(int id) { Post post = FindPost(id); if (post == null) { Console.WriteLine($"\nPost with ID number {id} doesn not exist"); } else { Console.WriteLine($"\nLike added to post ID {id}"); } post.Like(); }
/// <summary> /// Likes post with particular id /// </summary> /// <param name="id"></param> public void LikePost(int id) { Post post = FindPost(id); if (post == null) { Console.WriteLine("Post with id ", id, " does not exist."); } else { Console.WriteLine("Post has been liked."); post.Like(); post.Display(); } }
/// <summary> /// Like post based on the given id post /// </summary> public void LikePost(int id) { Post post = FindPost(id); if (post == null) { Console.WriteLine($"\nPost with ID: {id} does not exist!\n"); } else { Console.WriteLine($"\nYou have liked the the following post {id}!\n"); post.Like(); post.Display(); } }
/// <summary> /// This function allows the user to like /// any existing post by inputing the ID /// </summary> private void LikePost() { int id = (int)ConsoleHelper.InputNumber(" Please enter " + "the ID of the Post you wish to Like > "); Post post = news.FindPost(id); if (post != null) { post.Like(); } else { Console.WriteLine(" This post does not exist"); } ConsoleHelper.OutputTitle(" Post liked!"); }
/// <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(); } }
/// <summary> /// Like a post if the user is not the author of the post, /// or if they have already liked the post. /// </summary> private void LikePost(Post post) { if (Posts[VisiblePostIndex].Username == NetworkApp.CurrentUser) { RedAlert = " -- You cannot like your own posts --\n"; } else { if (!Likes.Contains(VisiblePostIndex)) { post.Like(); BlueAlert = " -- You liked this post --\n"; Likes.Add(VisiblePostIndex); } else { RedAlert = " -- You have already liked this post --\n"; } } }