public static void Main() { var newPost = new BlogPost { Title = "New Post", Description = "New Post Description." }; Console.ForegroundColor = ConsoleColor.DarkCyan; Console.WriteLine("-------------------------"); Console.WriteLine(newPost.Title); Console.WriteLine(newPost.Description); Console.WriteLine(newPost.CreationDateTime); Console.WriteLine("-------------------------"); Console.ResetColor(); do { //Console.WriteLine("Number of votes: " + newPost.DisplayVotes()); Console.ForegroundColor = ConsoleColor.DarkGray; Console.WriteLine("Please type 'Upvote' or 'Downvote'. Or 'Exit' to close."); Console.ResetColor(); Console.ForegroundColor = ConsoleColor.DarkCyan; _command = Console.ReadLine().ToLower(); Console.ResetColor(); switch (_command) { case "upvote": newPost.UpVote(); Console.ForegroundColor = ConsoleColor.DarkGreen; Console.WriteLine("Total votes:" + newPost.DisplayVotes()); Console.ResetColor(); break; case "downvote": newPost.DownVote(); Console.ForegroundColor = ConsoleColor.DarkMagenta; Console.WriteLine("Total votes:" + newPost.DisplayVotes()); Console.ResetColor(); break; default: Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Please enter a valid command"); Console.ResetColor(); break; } } while (_command != "exit"); }
public static void Main() { var newPost = new BlogPost { Title = "New Post", Description = "New Post Description." }; Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("-------------------------"); Console.WriteLine(newPost.Title); Console.WriteLine(newPost.Description); Console.WriteLine(newPost.CreationDateTime); Console.WriteLine("-------------------------"); do { //Console.WriteLine("Number of votes: " + newPost.DisplayVotes()); Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("Do you like my Blog?"); Console.WriteLine("Please let me know by typing: yes or no"); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("Type exit to leave the Blog"); _command = Console.ReadLine().ToLower(); switch (_command) { case "yes": newPost.UpVote(); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("You have " + newPost.DisplayVotes() + " votes"); break; case "no": newPost.DownVote(); Console.ForegroundColor = ConsoleColor.Magenta ; Console.WriteLine("You have " + newPost.DisplayVotes() + " votes"); break; default: Console.WriteLine("Please enter a valid command"); break; } } while (_command != "exit"); }
public static void Main() { var newPost = new BlogPost { Title = "New Post", Description = "New Post Description." }; Console.WriteLine("-------------------------"); Console.WriteLine(newPost.Title); Console.WriteLine(newPost.Description); Console.WriteLine(newPost.CreationDateTime); Console.WriteLine("-------------------------"); do { //Console.WriteLine("Number of votes: " + newPost.DisplayVotes()); Console.WriteLine("Please Type Like or Dislike to vote on Blog"); _command = Console.ReadLine().ToLower(); switch (_command) { case "like": newPost.UpVote(); Console.WriteLine("You have " + newPost.DisplayVotes() + " votes"); break; case "dislike": newPost.DownVote(); Console.WriteLine("You have " + newPost.DisplayVotes() + " votes"); break; default: Console.WriteLine("Please enter a valid command"); break; } } while (_command != "exit"); }