public FormDelete() { Console.WriteLine(Header); Console.Write("Enter note ID: "); string printId = Console.ReadLine(); int noteId = Convert.ToInt32(printId); NoteRepository noteRepository = new NoteRepository(); noteRepository.DeleteNote(noteId); GoStart("delete"); }
public FormCreate() { Console.WriteLine(Header); Console.Write($"Enter note title: "); string title = Console.ReadLine(); Console.Write("Enter note text: "); string text = Console.ReadLine(); NoteRepository noteRepository = new NoteRepository(); noteRepository.AddNote(title, text); GoStart("add"); }
public FormEdit() { Console.WriteLine(Header); Console.Write("Enter note ID: "); string printId = Console.ReadLine(); int noteId = Convert.ToInt32(printId); Console.Write($"Enter note title: "); string title = Console.ReadLine(); Console.Write("Enter note text: "); string text = Console.ReadLine(); NoteRepository noteRepository = new NoteRepository(); noteRepository.EditNote(noteId, title, text); GoStart("edit"); }
public FormList() { Console.WriteLine(Header); NoteRepository noteRepository = new NoteRepository(); Dictionary <int, Note> allNotes = noteRepository.GetAllNotes(); if (allNotes.Count == 0) { Console.WriteLine("No notes yet..."); Console.WriteLine("Press Enter to go back."); Console.ReadLine(); var formFactory = new FormFactory(); formFactory.GetForm(0); } else { foreach (KeyValuePair <int, Note> note in allNotes) { Console.WriteLine("[{0}] - {1}", note.Key, note.Value.Title); } } }