Example #1
0
        static void NewPost(Bastion bastion)
        {
            string title = ConsolePrompt(ConsoleColor.White, "Post title");
            string text = ConsolePrompt(ConsoleColor.White, "Post text");
            string link = ConsolePrompt(ConsoleColor.White, "Post link");
            string author = ConsolePrompt(ConsoleColor.White, "Post author");

            bastion.NewPost(new Post
            {
                Title = title,
                Text = text,
                Link = string.IsNullOrWhiteSpace(link) ? null : new Uri(link),
                Author = new Identity
                {
                    Name = author,
                    Identifier = IdentifierForName(author).ToString()
                },
                Timestamp = DateTimeOffset.UtcNow
            });
        }