Example #1
0
        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");
        }
Example #2
0
        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");
        }
Example #3
0
        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");
        }
Example #4
0
        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);
                }
            }
        }