private void Edit() { JournalEntry journalToEdit = Choose("Which entry would you like to edit?"); if (journalToEdit == null) { return; } Console.WriteLine(); Console.Write("New title (blank to leave unchanged: "); string title = Console.ReadLine(); if (!string.IsNullOrWhiteSpace(title)) { journalToEdit.Title = title; } Console.Write("New content (blank to leave unchanged: "); string content = Console.ReadLine(); if (!string.IsNullOrWhiteSpace(content)) { journalToEdit.Content = content; } _journalEntryRepository.Update(journalToEdit); }
private void Edit() { JournalEntry entryToEdit = Choose("Which entry would you like to edit?"); if (entryToEdit == null) { return; } Console.WriteLine(); Console.Write("New title (blank to leave unchanged: "); string title = Console.ReadLine(); if (!string.IsNullOrWhiteSpace(title)) { entryToEdit.Title = title; } Console.Write("New entry (blank to leave unchanged: "); string entry = Console.ReadLine(); if (!string.IsNullOrWhiteSpace(entry)) { entryToEdit.Content = entry; } Console.Write("New Date: (blank to leave unchanged: "); string UnparsedDate = Console.ReadLine(); if (!string.IsNullOrWhiteSpace(UnparsedDate)) { entryToEdit.CreateDateTime = Convert.ToDateTime(UnparsedDate); } _journalentryRepository.Update(entryToEdit); }