コード例 #1
0
ファイル: NotesProgram.cs プロジェクト: IvanHalych/HomeWork_4
        static void DeleteNote()
        {
            Console.Write("Enter the Id delete note:");
            string input = Console.ReadLine();
            var    note  = notes.Find(n => n.Id.ToString() == input);

            if (note == null)
            {
                Console.WriteLine("Note not found\n");
            }
            else
            {
                Console.WriteLine(note);
                Console.WriteLine("Confirm the deletion(yes)");
                input = Console.ReadLine();
                if (input == "yes")
                {
                    notes.Remove(note);
                    FileWork.Save(notes);
                }
            }
        }
コード例 #2
0
ファイル: NotesProgram.cs プロジェクト: IvanHalych/HomeWork_4
        public static void Run()
        {
            notes = FileWork.Load();
            Console.WriteLine("Name program: Notes");
            Console.WriteLine("Author: Halych Ivan");
            while (true)
            {
                Console.WriteLine("1.Search notes");
                Console.WriteLine("2.View note");
                Console.WriteLine("3.Create note");
                Console.WriteLine("4.Delete note");
                Console.WriteLine("5.Exit");
                string input = Console.ReadLine();
                switch (input)
                {
                case "1":
                    Search();
                    break;

                case "2":
                    ViewNote();
                    break;

                case "3":
                    CreateNote();
                    break;

                case "4":
                    DeleteNote();
                    break;

                case "5":
                    return;
                }
            }
        }