Exemplo n.º 1
0
        private static void PostInterface(PostPoco post)
        {
            if (Account.Id == post.UserId)
            {
                Console.WriteLine("DISCLAIMER: You can edit this post!");
                Console.WriteLine("Type: edit help to see how to edit!");
            }

            Console.WriteLine("Type 'all comments' to see all comments on this post! (If any)");
            Console.WriteLine("Type 'my comments' to see your comments on this post! (If any)");
            Console.WriteLine("Type 'comment post' to comment on this post!");
            Console.WriteLine("Type 'return' to return to the blog!");
            Console.WriteLine("Type 'refresh' to view again this post!\n");

            while (true)
            {
                Console.Write("Blog -->#Post: ");
                string line = Console.ReadLine()?.Trim().ToLowerInvariant().Replace(" ", string.Empty);

                if (!string.IsNullOrEmpty(line))
                {
                    if (line == "return")
                    {
                        break;
                    }

                    switch (line)
                    {
                    case "clear":
                        Console.Clear();
                        break;

                    case "refresh":
                        Post.ViewPost(CurrentPost);
                        break;

                    case "commentpost":
                        CreateCommentInterface();
                        break;

                    case "mycomments":
                        ShowUserComments();
                        break;

                    case "allcomments":
                        Blog.AllComments(CurrentPost);
                        break;

                    case "delete":
                        Blog.DeleteProcess(post);
                        break;

                    case "edithelp":
                        CommandPrinter.ShowPostEdits();
                        break;

                    case "edittitle":
                        Console.Write("New title: ");
                        Post.EditPostTitle(CurrentPost, Console.ReadLine() ?? " ");
                        break;

                    case "editcontent":
                        EditPostContentInterface();
                        break;

                    default:
                        Console.WriteLine("Your command was invalid!");
                        break;
                    }
                }
            }
        }
Exemplo n.º 2
0
 public static void ChoosePost(PostPoco post)
 {
     Post.ViewPost(post);
     PostInterface(post);
 }