public static void RemovePost(BlogManager Blog) { if (Blog.EmptyBlogOrComparising() == true) { Console.WriteLine(EMPTYBLOG); } else { Console.WriteLine("Enter ID of the post:"); int idToRemove = 0; try { idToRemove = Convert.ToInt16(Console.ReadLine()); } catch { Console.WriteLine(WRONGINPUT); return; } bool successfulOperationRemove = Blog.RemoveThePost(idToRemove); if (successfulOperationRemove == true) { Console.WriteLine(SEPARATOR + "\nThe post has been removed"); } else { Console.WriteLine("There is no such id"); } } Console.WriteLine(SEPARATOR + "\n" + CONTINUE); }
public static void ChangeThePost(BlogManager Blog) { if (Blog.EmptyBlogOrComparising() == true) { Console.WriteLine(EMPTYBLOG); } else { Console.WriteLine("To change the post enter its Id: "); int idPostToChange = 0; try { idPostToChange = Convert.ToInt16(Console.ReadLine()); } catch { Console.WriteLine(WRONGINPUT); return; } if (Blog.EmptyBlogOrComparising(idPostToChange) == true) { Console.WriteLine(SEPARATOR + "\nIf you don't want to change name or text of the post, just press ENTER\n" + SEPARATOR + "\nNew Name: "); string newName = Console.ReadLine(); Console.WriteLine("New Text: "); string newText = Console.ReadLine(); Blog.ChangeThePost(idPostToChange, newName, newText); Console.WriteLine(SEPARATOR + "\nThe post has being changed"); } else { Console.WriteLine(WRONGINPUT); return; } } Console.WriteLine(SEPARATOR + "\n" + CONTINUE); }