Esempio n. 1
0
        static void GetPost(Bastion bastion)
        {
            string id = ConsolePrompt(ConsoleColor.White, "ID");
            Post   p  = bastion.GetPost(id);

            ConsoleWriteLine(ConsoleColor.Gray, JsonConvert.SerializeObject(p, Formatting.Indented));
        }
Esempio n. 2
0
        static void PostVote(Bastion bastion)
        {
            string   id    = ConsolePrompt(ConsoleColor.White, "ID");
            Post     p     = bastion.GetPost(id);
            VoteType v     = ConsolePrompt(ConsoleColor.White, "U/D") == "U" ? VoteType.Upvote : VoteType.Downvote;
            string   name  = ConsolePrompt(ConsoleColor.White, "Post author");
            Identity voter = new Identity
            {
                Name       = name,
                Identifier = IdentifierForName(name).ToString()
            };

            bastion.Vote(p, voter, v);
        }