コード例 #1
0
ファイル: Note.cs プロジェクト: moutasem1989/flatnotes
        internal Note(string id, string title, string text, Checklist checklist, NoteImages images, NoteColor color, DateTime?createdAt, DateTime?updatedAt, DateTime?archivedAt) : this()
        {
            this.isChecklist = checklist != null && checklist.Count > 0;

            this.id         = id;
            this.title      = title;
            this.text       = this.isChecklist ? "" : text;
            this.checklist  = checklist;
            this.images     = images;
            this.color      = color is NoteColor ? color : NoteColor.DEFAULT;
            this.createdAt  = createdAt;
            this.updatedAt  = updatedAt;
            this.archivedAt = archivedAt;
        }
コード例 #2
0
        private void replaceNoteImages(NoteImages list)
        {
            Images.Clear();

            if (list == null || list.Count <= 0)
            {
                return;
            }

            foreach (var item in list)
            {
                Images.Add(item);
            }

            return;
        }
コード例 #3
0
        public void SetFrom(DTO.NoteDTO note, DatabaseContext dbContext)
        {
            Edited = DateTime.Now;

            Title    = note.Title;
            Body     = note.Body;
            Category = note.Category;

            NoteImages.Clear();
            foreach (DTO.ImageDTO image in note.Images)
            {
                NoteImages.Add(new Image(image));
            }

            // Repopulate note labels
            NoteLabels.Clear();
            foreach (DTO.LabelDTO label in note.Labels)
            {
                AddLabel(label, dbContext);
            }
        }