Exemple #1
0
        public static List<Note> GetNotesByTag(Tag tag)
        {
            var filteredNotes = new List<Note>();

            foreach (var note in AllNotesList)
            {
                foreach (var t in note.Tags)
                {
                    if (t.Text == tag.Text)
                    {
                        filteredNotes.Add(note);
                        break;
                    }
                }
            }

            return filteredNotes;
        }
Exemple #2
0
 public static Tag SetTag(string text)
 {
     if (AllTagsList == null || !AllTagsList.Any())
     {
         AllTagsList = new List<Tag>();
         AllTagsList.Add(new Tag { Text = text });
         return AllTagsList[0];
     }
     var tag = AllTagsList.Where(p => p.Text == text).FirstOrDefault();
     if (tag == null)
     {
         var newTag = new Tag { Text = text };
         AllTagsList.Add(newTag);
         return newTag;
     }
     else
         return tag;
 }