示例#1
0
        private void Edit()
        {
            Blog blogToEdit = Choose("Which blog would you like to edit?");

            if (blogToEdit == null)
            {
                return;
            }
            Console.WriteLine();
            Console.Write("New blog title (blank to leave unchanged):");
            string title = Console.ReadLine();

            if (!string.IsNullOrWhiteSpace(title))
            {
                blogToEdit.Title = title;
            }
            Console.Write("New blog URL (blank to leave unchanged): ");
            string url = Console.ReadLine();

            if (!string.IsNullOrWhiteSpace(url))
            {
                blogToEdit.Url = url;
            }
            _blogRepository.Update(blogToEdit);
        }