Exemplo n.º 1
0
        //Menu
        static void Main(string[] args)
        {
            List <Post> allPosts = PostFile.GetPosts();

            Menu(allPosts);
            Console.ReadKey();
        }
Exemplo n.º 2
0
        public static void AddPost(List <Post> allPosts)
        {
            Console.Clear();
            DateTime stamp = DateTime.Now;
            int      x     = allPosts.Count;

            Console.WriteLine("Write a new post!");
            string post = Console.ReadLine();

            allPosts.Add(new Post()
            {
                Id = x, Text = post, TimeStamp = stamp
            });
            PostFile.SavePosts(allPosts);
            Console.Clear();
            Console.WriteLine("Press any key to see updated posts");
            Console.ReadKey();
            Console.Clear();
            Console.WriteLine("Updated Post List");
            PrintPosts(allPosts);
            Console.WriteLine("Press any key to return to main menu");
            Console.ReadKey();
        }