Exemplo n.º 1
0
        static void Main(string[] args)
        {
            //Instanciando os comentários
            Comment c1 = new Comment("Have a nice trip!");
            Comment c2 = new Comment("Wow that's awesome!");

            //Instanciando o post
            Post p1 = new Post(DateTime.Parse("21/06/2018 13:05:44"),
                               "Traveling to New Zealand",
                               "I'm going to visit this wonderful country!",
                               12);

            //Adicionando os comentários aos posts
            p1.AddComment(c1);
            p1.AddComment(c2);

            Comment c3 = new Comment("Good night");
            Comment c4 = new Comment("May the Force be with you");

            Post p2 = new Post(DateTime.Parse("28/07/2018 23:14:19"),
                               "Good night guys",
                               "See you tomorrow",
                               5);

            p2.AddComment(c3);
            p2.AddComment(c4);

            //Imprimindo os dados dos posts:
            Console.WriteLine(p1);
            Console.WriteLine(p2);
        }
        static void Main(string[] args)
        {
            Comment c1 = new Comment("Have a nice trip!");
            Comment c2 = new Comment("Wow that's awesome!");
            Post    p1 = new Post(
                DateTime.Parse("17/11/2019 15:12:50"),
                "Traveling to New Zealand",
                "I'm going to visit this wonderful country!",
                12);

            p1.AddComment(c1);
            p1.AddComment(c2);

            Comment c3 = new Comment("Good night");
            Comment c4 = new Comment("May the Force be with you");
            Post    p2 = new Post(
                DateTime.Parse("16/11/2019 21:14:19"),
                "Good night guys",
                "See you tomorrow",
                5);

            p2.AddComment(c3);
            p2.AddComment(c4);

            Console.WriteLine(p1);
            Console.WriteLine(p2);
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            Comment c1 = new Comment("Have a nice trip! ");
            Comment c2 = new Comment("Wow That's awesome! ");

            Post p1 = new Post(
                DateTime.Parse("21/06/2018 13:05:44"),
                "Travling to New Zealand",
                "I'm going to visit this wonderful country",
                12);

            p1.AddComment(c1);
            p1.AddComment(c2);

            Comment c3 = new Comment("Good night");
            Comment c4 = new Comment("May the force be with tou");

            Post p2 = new Post(DateTime.Parse("28/07/2018 23:14:19"), "Good night guys", "See you tomorrow", 5);

            p2.AddComment(c3);
            p2.AddComment(c4);

            Console.WriteLine(p1);
            Console.WriteLine(p2);
        }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            Comments c1 = new Comments("Have a nice trip!");
            Comments c2 = new Comments("Wow that's awesome!");
            Post     p1 = new Post(
                DateTime.Parse("21/06/2018 12:05:44"),
                "Traveling to New Zeland",
                "I'm going to visit this wonderful country!",
                12);

            p1.AddComment(c1);
            p1.AddComment(c2);

            c1 = new Comments("Tenha uma boa viagem!");
            c2 = new Comments("Ótimo país!");
            Post p2 = new Post(
                DateTime.Parse("22/06/2018 12:05:44"),
                "Traveling to New Zeland",
                "I'm going to visit this wonderful country!",
                12);

            p2.AddComment(c1);
            p2.AddComment(c2);

            Console.WriteLine(p1);
            Console.WriteLine();
            Console.WriteLine(p2);
            Console.ReadLine();
        }
        static void Main(string[] args)
        {
            Comment c1 = new Comment("Have a nice trip!");
            Comment c2 = new Comment("Wow that's awesome!");
            Post    p1 = new Post(DateTime.Parse("21/06/2018 13:05:44"),
                                  "Traveling to New Zealand",
                                  "I'm going to visit this wonderful country!",
                                  12);

            p1.AddComment(c1);
            p1.AddComment(c2);

            Comment c3 = new Comment("Good night!");
            Comment c4 = new Comment("May the Force be with you");
            Post    p2 = new Post(DateTime.Parse("28/06/2018 23:24:19"),
                                  "Good night guys",
                                  "See you tomorrow",
                                  5);

            p1.AddComment(c3);
            p1.AddComment(c4);

            // just not to close cmd
            Console.ReadLine();
        }
        static void Main(string[] args)
        {
            Comment c1 = new Comment("Have a nice trip!");
            Comment c2 = new Comment("Wow that's awesome!");
            Comment c3 = new Comment("https://www.youtube.com/watch?v=wXMD6wmcwvE");

            Post p1 = new Post(
                DateTime.Parse("21/06/2018 13:05:44"),
                "Traveling to New Zealand",
                "I'm going to visit this wonderful country!",
                12);

            p1.AddComment(c1);
            p1.AddComment(c2);
            p1.AddComment(c3);

            Comment c4 = new Comment("Good night");
            Comment c5 = new Comment("May the force be with you :)");
            Post    p2 = new Post(
                DateTime.Parse("28/07/2018 23:14:19"),
                "Good night guys",
                "See ya tommorrow",
                5);

            p2.AddComment(c4);
            p2.AddComment(c5);

            Console.WriteLine(p1);
            Console.WriteLine(p2);
        }
Exemplo n.º 7
0
        static void Main(string[] args)
        {
            Comment comment1 = new Comment("Have a nice trip!");
            Comment comment2 = new Comment("Wow that's awsome!");

            Post post1 = new Post
                         (
                DateTime.Parse("06/21/2018 13:05:44"),
                "Traveling to New Zeland",
                "I'm going to visit this wonderful country!",
                12
                         );

            post1.AddComment(comment1);
            post1.AddComment(comment2);

            Comment comment3 = new Comment("Good night");
            Comment comment4 = new Comment("May the force be with you");

            Post post2 = new Post
                         (
                DateTime.Parse("07/28/2018 13:14:19"),
                "Good night guys",
                "See you tomorrow",
                5
                         );

            post2.AddComment(comment3);
            post2.AddComment(comment4);

            Console.WriteLine(post1);
            Console.WriteLine(post2);
        }
Exemplo n.º 8
0
        static void Main(string[] args)
        {
            //Instanciar os comentários primeiro

            Comment c1 = new Comment("Have a nice trip");
            Comment c2 = new Comment("Wow, that is awesome!");

            Post p1 = new Post(
                DateTime.Parse("21/06/2018 13:05:44"),
                "Traveling to New Zeland",
                "I'm going to visit this wanterfull coountry",
                12);

            // Adicionar os comentáros na lista
            p1.AddComment(c1);
            p1.AddComment(c2);


            Comment c3 = new Comment("Good Night");
            Comment c4 = new Comment("May the Force be with you");

            Post p2 = new Post(
                DateTime.Parse("21/06/2018 13:05:44"),
                "Good Night Guys",
                "See you tomorrow",
                5);

            p2.AddComment(c3);
            p2.AddComment(c4);


            Console.WriteLine(p1);
            Console.WriteLine(p2);
        }
Exemplo n.º 9
0
        static void Main(string[] args)
        {
            Comment c1 = new Comment("Good to know this!");
            Comment c2 = new Comment("Nice!");
            Post    p1 = new Post(
                DateTime.ParseExact("21/06/2018 13:05:44", "dd/MM/yyyy HH:mm:ss",       // Resolvido com ParseExact !
                                    CultureInfo.InvariantCulture),
                "TV Sound Exit",
                "It has a headphone plug",
                12);

            p1.AddComment(c1);
            p1.AddComment(c2);

            Comment c3 = new Comment("Nice!");
            Comment c4 = new Comment("Thanks for the information!");
            Post    p2 = new Post(
                DateTime.Parse("07/28/2018 23:14:19"),              // No código original foi preciso usar mês/ano !
                "TV Voltage",                                       // Problema foi resolvido com ParseExact na
                "It is Bivolt 90v/240v",                            // ocorrencia anterior. Será que é o OSX (MAC) ?
                5);

            p2.AddComment(c3);
            p2.AddComment(c4);

            Console.WriteLine(p1);
            Console.WriteLine(p2);
        }
Exemplo n.º 10
0
        public IList <IPost> GetAll()
        {
            var title       = "When you are doing homework while sleep deprived";
            var description = "So in doing this assignment, I originally started at 1:00 am, after only getting two hours of sleep. Which by itself may seem fine, but the problem was that I decided to review the requirements for both assignment 5 and 6. In short, as a result, I made this assignment WAAAY harder than it was supposed to be, including a menu, an archive of posts, and a way to display all of the archived posts, among other things. Morale of the story, don't do programming with only two hours of sleep.";
            var createdby   = "Daniel Fischer (aka the dumbass)";

            var post = new Post(title, description, createdby);

            var commentTitle1       = "I hear ya!";
            var commentDescription1 = "Yep, I have been there, and done that as well, AND at the exact same time as you did!";
            var commentCreator1     = "Second Personality";

            var comment1 = new Comment(commentTitle1, commentDescription1, commentCreator1);

            var commentTitle2       = "I agree with your alias";
            var commentDescription2 = "You are right, you are totally a dumbass! Learn to follow instructions you pleeb!";
            var commentCreator2     = "Third Personality";

            var comment2 = new Comment(commentTitle2, commentDescription2, commentCreator2);

            post.AddComment(comment1);
            post.AddComment(comment2);

            post.IncreaseUpVotes();
            post.IncreaseUpVotes();
            post.IncreaseUpVotes();
            post.IncreaseDownVotes();
            post.IncreaseDownVotes();

            return(new List <IPost>()
            {
                post
            });
        }
Exemplo n.º 11
0
        static void Main(string[] args)
        {
            Comment c1 = new Comment("Have a nice trip ");
            Comment c2 = new Comment("Wow , that awesome! ");
            Comment c3 = new Comment("Good night! ");
            Comment c4 = new Comment("May the force be with you ");

            Post p1 = new Post(
                DateTime.Parse("21/10/2018 13:05:11 "),
                "Traveling  new zealand",
                "I going",
                12
                );

            p1.AddComment(c1);
            p1.AddComment(c2);

            Post p2 = new Post(
                DateTime.Parse("29/05/2019 20:05:11 "),
                "Good night",
                "Se you",
                5
                );

            p2.AddComment(c3);
            p2.AddComment(c4);

            Console.WriteLine(p1);
        }
Exemplo n.º 12
0
        static void Main(string[] args)
        {
            Comment c1 = new Comment("have a nice trip");
            Comment c2 = new Comment("Wow thats awesome");

            Post p1 = new Post(
                DateTime.Parse("24/06/2018 13:05:44"),
                "Travelig to New Zeland",
                "Im goig to visit this woderful country",
                12
                );

            p1.AddComment(c1);
            p1.AddComment(c2);

            Comment c3 = new Comment("Good night");
            Comment c4 = new Comment("May the force with you");

            Post p2 = new Post(
                DateTime.Parse("28/07/2018 23:14:19"),
                "Good night guys",
                "see you tomorrow",
                5

                );

            p2.AddComment(c3);
            p2.AddComment(c4);

            System.Console.WriteLine(p1);
            System.Console.WriteLine(p2);
        }
Exemplo n.º 13
0
        static void Main(string[] args)
        {
            Comment c1 = new Comment("Have a nice trip");
            Comment c2 = new Comment("waw that's awesome!");
            Post    p1 = new Post(
                DateTime.Parse("18/01/2019 11:25:45"),
                "Traveling to Angola",
                "I was deported to this wonderfull country! ",
                1023
                );

            p1.AddComment(c1);
            p1.AddComment(c2);

            Console.WriteLine();

            Comment c3 = new Comment("Good nigth ");
            Comment c4 = new Comment("Bro keep your mind strong it's normal, I hope u will back soon");
            Post    p2 = new Post(
                DateTime.Parse("20/01/2019 22:39:23"),
                "Good nigth guys! ",
                "See you tommorow, to show how life is better in Africa! ",
                3023
                );

            p2.AddComment(c3);
            p2.AddComment(c4);

            Console.WriteLine("\tInstagram Simulation");
            Console.WriteLine("\t-----------------------------\n");
            Console.WriteLine(p1);
            Console.WriteLine(p2);
        }
Exemplo n.º 14
0
        static void Main(string[] args)
        {
            string   title1   = "Traveling to New Zealand";
            int      likes1   = 12;
            DateTime moment1  = DateTime.Parse("21/06/2018 13:05:44");
            string   content1 = "I'm going to visit this wonderful country!";
            Post     post1    = new Post(moment1, title1, content1, likes1);

            Comment comment1 = new Comment("Have a nice trip");

            post1.AddComment(comment1);

            Comment comment2 = new Comment("Wow that's awesome!");

            post1.AddComment(comment2);

            string   title2   = "Good night guys";
            int      likes2   = 5;
            DateTime moment2  = DateTime.Parse("28/07/2018 23:14:19");
            string   content2 = "See you tomorrow";
            Post     post2    = new Post(moment2, title2, content2, likes2);

            Comment comment3 = new Comment("Good night");

            post2.AddComment(comment3);
            Comment comment4 = new Comment("May the force be with you");

            post2.AddComment(comment4);

            Console.WriteLine(post1);
            Console.WriteLine(post2);
        }
Exemplo n.º 15
0
        static void Main(string[] args)
        {
            Comment comment1 = new Comment("Have a nice trip!");
            Comment comment2 = new Comment("Wow that' awesome!");

            Post post1 = new Post()
            {
                Moment  = DateTime.Parse("21/06/2020 13:05:44"),
                Title   = "Traveling to New Zealand",
                Content = "I'm going to visit this wonderful country!",
                Likes   = 12
            };

            post1.AddComment(comment1);
            post1.AddComment(comment2);

            Console.WriteLine(post1);

            Comment comment3 = new Comment("Good night");
            Comment comment4 = new Comment("May the force be with you");

            Post post2 = new Post()
            {
                Moment  = DateTime.Parse("28/07/2020 23:14:19"),
                Title   = "Good night guys",
                Content = "See you tomorrow",
                Likes   = 5
            };

            post2.AddComment(comment3);
            post2.AddComment(comment4);

            Console.WriteLine(post2);
        }
Exemplo n.º 16
0
        static void Main(string[] args)
        {
            // Instancie manualmente os objetos mostrados abaixo e mostre-os na tela do terminal, conforme exemplo.

            Comment c1 = new Comment("Have a nice trip!");
            Comment c2 = new Comment("Wow that's awesome!");

            Post p1 = new Post(
                DateTime.Parse("21/06/2018 13:05:44"),
                "Traveling to New Zealand",
                "I'm going to visit this wonderful country!",
                12);

            p1.AddComment(c1);
            p1.AddComment(c2);

            Comment c3 = new Comment("Good night!");
            Comment c4 = new Comment("May the Force be with you!");

            Post p2 = new Post(
                DateTime.Parse("28/07/2018 23:14:19"),
                "Good night guys",
                "See you tomorrow",
                5);

            p2.AddComment(c3);
            p2.AddComment(c4);

            Console.WriteLine(p1);
            Console.WriteLine(p2);
        }
Exemplo n.º 17
0
        static void Main(string[] args)
        {
            Comment c1 = new Comment("Have a nice trip");
            Comment c2 = new Comment("Wow that's awesome!");
            Post    p1 = new Post(
                DateTime.Now,
                "Traveling to new Zealand",
                "I'm gong to visit this wonderful country",
                12
                );

            p1.AddComment(c1);
            p1.AddComment(c2);
            Comment c3 = new Comment("Good night");
            Comment c4 = new Comment("MAy the Force be with you");
            Post    p2 = new Post(
                DateTime.Parse("21/06/2018 13:21:22"),
                "Good night guys",
                "See you tomorrow",
                5
                );

            p2.AddComment(c3);
            p2.AddComment(c4);

            Console.WriteLine(p1);
            Console.WriteLine(p2);
        }
Exemplo n.º 18
0
        static void Main(string[] args)
        {
            List <Post> posts = new List <Post>();
            Post        post1 = new Post(DateTime.Now, "Traveling to New Zealand",
                                         "I'm going to visit this wonderful country!", 12);
            Comment comment1 = new Comment("Have a nice trip");
            Comment comment2 = new Comment("Wow that's awesome!");

            post1.AddComment(comment1);
            post1.AddComment(comment2);

            Post    post2    = new Post(DateTime.Now, "Good night guys", "See you tomorrow", 5);
            Comment comment3 = new Comment("Good night");
            Comment comment4 = new Comment("May the force be with you");

            post2.AddComment(comment3);
            post2.AddComment(comment4);

            posts.Add(post1);
            posts.Add(post2);

            foreach (Post post in posts)
            {
                Console.WriteLine(post);
                Console.WriteLine();
            }
        }
Exemplo n.º 19
0
        static void Main(string[] args)
        {
            Comment c1 = new Comment("Have a nice trip!");
            Comment c2 = new Comment("Wow that's awesome!");
            Post    p1 = new Post(
                DateTime.Parse("21/06/2018 13:05:44"),
                "Traveling to New Zealand",
                "I'm going to visit this wonderful country",
                12);

            p1.AddComment(c1);
            p1.AddComment(c2);

            Comment c3 = new Comment("You very nice!");
            Comment c4 = new Comment("I lov you <3 !");
            Post    p2 = new Post(
                DateTime.Parse("24/12/2019 14:10:10"),
                "Traveling to New York",
                "I'm going to visit this big country",
                12);

            p2.AddComment(c3);
            p2.AddComment(c4);

            Console.WriteLine(p1);
            Console.WriteLine(p2);
        }
Exemplo n.º 20
0
        static void Main(string[] args)
        {
            Comment c1 = new Comment("Have a nice trip");
            Comment c2 = new Comment("Wow that´s awesome!");

            Post p1 = new Post(
                DateTime.Parse("21/06/2018 13:05:44"),
                "Traveling to new zealand",
                "I´m going to visit this wonderful country",
                12);

            p1.AddComment(c1);
            p1.AddComment(c2);


            Comment c3 = new Comment("HELLO MAN");
            Comment c4 = new Comment("No Urdestand!");

            Post p2 = new Post(
                DateTime.Parse("28/06/2018 14:05:44"),
                "Traveling to new zealand",
                "I´m going to visit this wonderful country",
                5);

            p2.AddComment(c3);
            p2.AddComment(c4);

            Console.WriteLine(p1);
            Console.WriteLine(p2);
        }
Exemplo n.º 21
0
        static void Main(string[] args)
        {
            Comment c1 = new Comment("Have a nice trip!");   //Tenha uma boa viagem!
            Comment c2 = new Comment("Wow that's awesome!"); //Uau isso é incrível!
            //instanciando o post
            Post p1 = new Post(
                DateTime.Parse("20/04/2020 15:52:55"),
                "Traveling to New Zealand",                        //Viajar para a Nova Zelândia
                "I'm going to visit this wonderful country!", 12); //Eu vou visitar este país maravilhoso!

            p1.AddComment(c1);
            p1.AddComment(c2);

            Comment c3 = new Comment("Good night");                //Boa Noite!
            Comment c4 = new Comment("May the Force be with you"); //Que a força esteja com você
            //instanciando o post
            Post p2 = new Post(
                DateTime.Parse("21/04/2020 12:52:55"),
                "Good nigth guys",       //Boa noite galera
                "See you tomorrow", 22); //Te vejo amanhã

            p2.AddComment(c3);
            p2.AddComment(c4);

            Console.WriteLine(p1);
            Console.WriteLine(p2);

            Console.ReadLine();
        }
Exemplo n.º 22
0
        public void SocialMidia()
        {
            Comment c1 = new Comment("Have a nice trip");
            Comment c2 = new Comment("Wow that's awesome!");
            Post    p1 = new Post(
                DateTime.Parse("2018/06/21 13:05:44"),
                "Traveling to New Zealand",
                "I'm going to visit this wonderful country!",
                12
                );

            p1.AddComment(c1);
            p1.AddComment(c2);

            Comment c3 = new Comment("Good night");
            Comment c4 = new Comment("May the force be with you");
            Post    p2 = new Post(
                DateTime.Parse("2018/07/28 23:14:19"),
                "Good night guys",
                "See you tomorrow",
                5
                );

            p2.AddComment(c3);
            p2.AddComment(c4);

            Console.WriteLine(p1);
            Console.WriteLine(p2);
        }
Exemplo n.º 23
0
        static void Main(string[] args)
        {
            Post post = new Post()
            {
                Moment   = DateTime.Parse("21/06/2018 13:05:44"),
                Title    = "Traveling to New Zealand",
                Content  = "I'm going to visit this wonderful country!",
                Likes    = 12,
                Comments =
                {
                    new Comment("Have a nice trip"),
                    new Comment("Wow that's awesome!")
                }
            };

            Console.WriteLine(post);

            Console.WriteLine();

            Post post2 = new Post()
            {
                Moment  = DateTime.Parse("28/07/2018 23:14:19"),
                Title   = "Good night guys",
                Content = "See you tomorrow",
                Likes   = 5
            };

            post2.AddComment(new Comment("Good Night"));
            post2.AddComment(new Comment("May the Force be with you!"));

            Console.WriteLine(post2);
        }
Exemplo n.º 24
0
        static void Main(string[] args)
        {
            Comment c1 = new Comment("Have a nice trip");
            Comment c2 = new Comment("wow that´s awesome");
            Post    p1 = new Post(
                DateTime.Now,
                "Traveling to new Zealand",
                "I´m going to visit this wonderful coun",
                12);

            p1.AddComment(c1);
            p1.AddComment(c2);

            Comment c3 = new Comment("Good night");
            Comment c4 = new Comment("may the force be with you");
            Post    p2 = new Post(
                DateTime.Now,
                "good night guys",
                "see you tomorrow",
                5);

            p2.AddComment(c3);
            p2.AddComment(c4);

            Console.WriteLine(p1);
            Console.WriteLine(p2);
        }
Exemplo n.º 25
0
        static void Main(string[] args)
        {
            Post p1 = new Post(
                DateTime.Parse("17/05/2020 12:20:15"),         //date
                "Traveling to Iceland",                        //title
                "Can't wait to visit this wonderful country!", //content
                12);                                           //likes
            Comment c1 = new Comment("Have a nice trip!");
            Comment c2 = new Comment("Enjoy!");

            p1.AddComment(c1);
            p1.AddComment(c2);

            Post p2 = new Post(
                DateTime.Now,
                "Tv Shows",
                "I need to find a new tv show",
                5);
            Comment c3 = new Comment("I'm pretty sure you'll love Game of Thrones");
            Comment c4 = new Comment("You should study C# lol");

            p2.AddComment(c3);
            p2.AddComment(c4);

            Console.WriteLine(p1);
            Console.WriteLine(p2);
        }
Exemplo n.º 26
0
        static void Main(string[] args)
        {
            Comment c1 = new Comment("Have a nice trip");
            Comment c2 = new Comment("Wow that's awesome!");

            Post p1 = new Post(DateTime.Parse("15/06/2020 11:13:44"),
                               "Traveling to new Zealand",
                               "I'm going to visit this wonderful country", 12
                               );

            // Adicionando os dois comentario no Post:
            p1.AddComment(c1);
            p1.AddComment(c2);


            Comment c3 = new Comment("Good noght");
            Comment c4 = new Comment("May the force be with you");
            Post    p2 = new Post(DateTime.Parse("16/06/2020 11:28:02"),
                                  "Good night guys",
                                  "See you tomorow", 5
                                  );

            p2.AddComment(c3);
            p2.AddComment(c4);

            // Imprimir o conteudo na tela de cada post com os comentarios:

            Console.WriteLine(p1);
            Console.WriteLine(p2);
        }
Exemplo n.º 27
0
        static void Main(string[] args)
        {
            Comment c1 = new Comment("Have a nice trip");
            Comment c2 = new Comment("Wow that's awesome!");
            Post    p1 = new Post(
                DateTime.Parse("23/03/2020 5:15:40"),
                "Traveling to New Zealand",
                "I'm gonna visit this wonderful country",
                12);

            p1.AddComment(c1);
            p1.AddComment(c2);

            Comment c3 = new Comment("Good night");
            Comment c4 = new Comment("May the force be with you");
            Post    p2 = new Post(
                DateTime.Parse("28/07/2020 23:48:51"),
                "Good Night guys",
                "See ya tomorrow",
                12);

            p2.AddComment(c3);
            p2.AddComment(c4);

            Console.WriteLine(p1);
            Console.WriteLine(p2);
        }
Exemplo n.º 28
0
        public static void testePost()
        {
            Comment c1 = new Comment("Have a nice trip: ");
            Comment c2 = new Comment("Wow that's aweme! ");

            Post p1 = new Post(
                DateTime.Parse("21/06/2018 13:05:44"),
                "Traveling to new Zeland",
                "I'm going to visit this worderful country",
                12
                );

            p1.AddComment(c1);
            p1.AddComment(c2);

            Comment c3 = new Comment("Good night: ");
            Comment c4 = new Comment("May the Force be With you! ");

            Post p2 = new Post(
                DateTime.Parse("28/06/2018 13:05:44"),
                "good night guys",
                "See you tomorrow",
                5
                );

            p2.AddComment(c3);
            p2.AddComment(c4);

            Console.WriteLine(p1);
            Console.WriteLine(p2);
        }
Exemplo n.º 29
0
        static void Main(string[] args)
        {
            Comment c1 = new Comment("Traz muamba!");
            Comment c2 = new Comment("Compra vinho!");

            Post p1 = new Post(
                DateTime.Parse("21/06/2020 13:05:44"),
                "Viajando pro Paraguai!",
                "Vou trazer umas muambas, quem tá afim?",
                12);

            p1.AddComment(c1);
            p1.AddComment(c2);

            Comment c3 = new Comment("Compre um AzBox");
            Comment c4 = new Comment("Vai na feirinha da Argentina");

            Post p2 = new Post(
                DateTime.Parse("02/02/2021 14:20:31"),
                "Já estou aqui no Paraguai!",
                "Enviem dicas de onde comer no Paraguai",
                5);

            p2.AddComment(c3);
            p2.AddComment(c4);

            Console.WriteLine(p1);
            Console.WriteLine(p2);
        }
Exemplo n.º 30
0
        static void Main(string[] args)
        {
            Comment c1 = new Comment("Have a nice trip!");    //Tenha uma boa Viagem
            Comment c2 = new Comment("Woe that´s awesome! "); //ual que legal
            Post    p1 = new Post(
                DateTime.Parse("03/10/2019 12:05:44"),
                "Traveling to Brasil",
                "I´m going to visit worderfull country",
                12);

            p1.AddComment(c1);
            p1.AddComment(c2);

            Comment c3 = new Comment("Good NIght!");
            Comment c4 = new Comment("May the force be with you"); // Que a força esteja com você
            Post    p2 = new Post(
                DateTime.Parse("03/10/2019 13:05:05"),
                "Good nigth guys ",  //Boa noite pessoal
                "See you Tommorow ", // ATÉ AMANHA
                5);


            Console.WriteLine(p1);
            Console.WriteLine(p2);
        }
Exemplo n.º 31
0
 public virtual void CanSaveAndDeletePostWithComments()
 {
     var post = new Post();
     post.AddComment(new Comment());
     _session.Save(post);
     _session.Flush();
     _session.Delete(post);
     _session.Flush();
 }
        public void AddCommentToBlogPost(string body, bool userSubscribed, User user, Post post)
        {
            var comment = new Comment
            {
                Body = body,
                User = user,
                Post = post,
                UserSubscribed = userSubscribed
            };

            //TODO: Need to implement publishing/pending stuff
            comment.Published = DateTime.UtcNow;

            post.AddComment(comment);
            _repository.Save(post);
        }
        public void AddCommentToBlogPost(string body, bool userSubscribed, User user, Post post, string twitterUserName)
        {
            if (string.IsNullOrEmpty(twitterUserName))
                twitterUserName = string.Empty;

            var comment = new Comment
            {
                Body = body,
                User = user,
                Post = post,
                UserSubscribed = userSubscribed,
                TwitterUserName = twitterUserName,
            };

            //TODO: Need to implement publishing/pending stuff
            comment.Published = DateTime.UtcNow;

            post.AddComment(comment);
            _repository.Save(post);

            _twitterService.SendCommentPostedReply(post, twitterUserName, user.DisplayName);
        }
 /// <summary>
 /// Insert the pingback as a comment on the post.
 /// </summary>
 /// <param name="sourceUrl">
 /// The source Url.
 /// </param>
 /// <param name="post">
 /// The post to comment on.
 /// </param>
 /// <param name="blogName">
 /// The blog Name.
 /// </param>
 /// <param name="title">
 /// The title.
 /// </param>
 /// <param name="excerpt">
 /// The excerpt.
 /// </param>
 private static void AddComment(string sourceUrl, Post post, string blogName, string title, string excerpt)
 {
     var comment = new Comment
         {
             Id = Guid.NewGuid(),
             Author = blogName,
             Website = new Uri(sourceUrl),
             Content = title + Environment.NewLine + Environment.NewLine + excerpt,
             Email = "trackback",
             Parent = post,
             DateCreated = DateTime.Now,
             IP = HttpContext.Current.Request.UserHostAddress,
             IsApproved = true
         };
     post.AddComment(comment);
 }
Exemplo n.º 35
0
 /// <summary>
 /// Insert the pingback as a comment on the post.
 /// </summary>
 private void AddComment(string sourceUrl, Post post)
 {
     Comment comment = new Comment();
     comment.Id = Guid.NewGuid();
     comment.Author = GetDomain(sourceUrl);
     comment.Website = new Uri(sourceUrl);
     comment.Content = "Pingback from " + comment.Author + Environment.NewLine + Environment.NewLine + _Title;
     comment.DateCreated = DateTime.Now;
     comment.Email = "pingback";
     comment.IP = HttpContext.Current.Request.UserHostAddress;
     comment.Parent = post;
     comment.IsApproved = true; //NOTE: Pingback comments are approved by default.
     post.AddComment(comment);
 }
        private void setup_sample_post(User user)
        {
            var oxiteTag = new Tag {Name = "Oxite", CreatedDate = DateTime.Parse("12 NOV 2008")};

            var defaultPost = new Post
            {
                Title = "World.Hello()",
                Slug = "World_Hello",
                BodyShort = "Welcome to Oxite! &nbsp;This is a sample application targeting developers built on <a href=\"http://asp.net/mvc\">ASP.NET MVC</a>. &nbsp;Make any changes you like. &nbsp;If you build a feature you think other developers would be interested in and would like to share your code go to the <a href=\"http://www.codeplex.com/oxite\">Oxite Code Plex project</a> to see how you can contribute.<br /><br />To get started, sign in with \"Admin\" and \"pa$$w0rd\" and click on the Admin tab.<br /><br />For more information about <a href=\"http://oxite.net\">Oxite</a> visit the default <a href=\"/About\">About</a> page.",
                Body = "Welcome to Oxite! &nbsp;This is a sample application targeting developers built on <a href=\"http://asp.net/mvc\">ASP.NET MVC</a>. &nbsp;Make any changes you like. &nbsp;If you build a feature you think other developers would be interested in and would like to share your code go to the <a href=\"http://www.codeplex.com/oxite\">Oxite Code Plex project</a> to see how you can contribute.<br /><br />To get started, sign in with \"Admin\" and \"pa$$w0rd\" and click on the Admin tab.<br /><br />For more information about <a href=\"http://oxite.net\">Oxite</a> visit the default <a href=\"/About\">About</a> page.",
                Published = DateTime.Parse("2008-12-05 09:29:03.270"),
                User = user
            };
            defaultPost.AddTag(oxiteTag);

            _repository.Save(defaultPost);

            var defaultPost1 = new Post
            {
                Title = "World.Hello()",
                Slug = "World_Hello2",
                BodyShort = "Welcome to Oxite! &nbsp;This is a sample application targeting developers built on <a href=\"http://asp.net/mvc\">ASP.NET MVC</a>. &nbsp;Make any changes you like. &nbsp;If you build a feature you think other developers would be interested in and would like to share your code go to the <a href=\"http://www.codeplex.com/oxite\">Oxite Code Plex project</a> to see how you can contribute.<br /><br />To get started, sign in with \"Admin\" and \"pa$$w0rd\" and click on the Admin tab.<br /><br />For more information about <a href=\"http://oxite.net\">Oxite</a> visit the default <a href=\"/About\">About</a> page.",
                Body = "Welcome to Oxite! &nbsp;This is a sample application targeting developers built on <a href=\"http://asp.net/mvc\">ASP.NET MVC</a>. &nbsp;Make any changes you like. &nbsp;If you build a feature you think other developers would be interested in and would like to share your code go to the <a href=\"http://www.codeplex.com/oxite\">Oxite Code Plex project</a> to see how you can contribute.<br /><br />To get started, sign in with \"Admin\" and \"pa$$w0rd\" and click on the Admin tab.<br /><br />For more information about <a href=\"http://oxite.net\">Oxite</a> visit the default <a href=\"/About\">About</a> page.",
                Published = DateTime.Parse("2008-12-05 09:29:03.270"),
                User = user
            };
            defaultPost1.AddTag(oxiteTag);
            defaultPost1.AddTag(new Tag { Name = "AltOxite", CreatedDate = DateTime.Parse("30 DEC 2008") });
            defaultPost1.AddComment(new Comment { Post = defaultPost1, User = user, Body = "test comment", Published = DateTime.Parse("31 DEC 2008") });

            _repository.Save(defaultPost1);
        }
Exemplo n.º 37
0
 /// <summary>
 /// Insert the pingback as a comment on the post.
 /// </summary>
 private static void AddComment(string sourceUrl, Post post, string blogName, string excerpt)
 {
     Comment comment = new Comment();
     comment.Id = Guid.NewGuid();
     comment.Author = blogName;
     comment.Website = new Uri(sourceUrl);
     comment.Content = "Trackback from " + comment.Author + Environment.NewLine + Environment.NewLine + excerpt;
     comment.Email = "trackback";
     comment.Parent = post;
     comment.DateCreated = DateTime.Now;
     comment.IP = HttpContext.Current.Request.UserHostAddress;
     comment.IsApproved = true; //NOTE: Trackback comments are approved by default
     post.AddComment(comment);
 }
 /// <summary>
 /// Insert the pingback as a comment on the post.
 /// </summary>
 /// <param name="sourceUrl">
 /// The source Url.
 /// </param>
 /// <param name="post">
 /// The post to add the comment to.
 /// </param>
 private void AddComment(string sourceUrl, Post post)
 {
     var comment = new Comment
         {
             Id = Guid.NewGuid(),
             Author = GetDomain(sourceUrl),
             Website = new Uri(sourceUrl)
         };
     comment.Content = string.Format("Pingback from {0}{1}{2}{3}", comment.Author, Environment.NewLine, Environment.NewLine, this.title);
     comment.DateCreated = DateTime.Now;
     comment.Email = "pingback";
     comment.IP = HttpContext.Current.Request.UserHostAddress;
     comment.Parent = post;
     comment.IsApproved = true; // NOTE: Pingback comments are approved by default.
     post.AddComment(comment);
 }