Esempio n. 1
0
        static void Main(string[] args)
        {
            NotesStore notes = new NotesStore();

            notes.AddNote("completed", "Hello");
            notes.AddNote("completed", "Hello2");
            notes.AddNote("completed", "Hello3");
            notes.AddNote("active", "Hello4");
            notes.AddNote("completed", "Hello5");
            notes.AddNote("others", "Hello5");
            notes.AddNote("othe3rs", "Hello5");
            var newNotes = notes.GetNotes("completed");

            foreach (var note in newNotes)
            {
                Console.WriteLine(note);
            }
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            var notesStoreObj = new NotesStore();
            var n             = int.Parse(Console.ReadLine());

            for (var i = 0; i < n; i++)
            {
                var operationInfo = Console.ReadLine().Split(' ');
                try
                {
                    if (operationInfo[0] == "AddNote")
                    {
                        notesStoreObj.AddNote(operationInfo[1], operationInfo.Length == 2 ? "" : operationInfo[2]);
                    }
                    else if (operationInfo[0] == "GetNotes")
                    {
                        var result = notesStoreObj.GetNotes(operationInfo[1]);
                        if (result.Count == 0)
                        {
                            Console.WriteLine("No Notes");
                        }
                        else
                        {
                            Console.WriteLine(string.Join(",", result));
                        }
                    }
                    else
                    {
                        Console.WriteLine("Invalid Parameter");
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine("Error: " + e.Message);
                }
            }
        }