Пример #1
0
        public Note(DTO.NoteDTO note, DatabaseContext dbContext)
        {
            Title    = note.Title;
            Body     = note.Body;
            Category = note.Category;
            Created  = note.Created;
            Edited   = note.Edited;

            NoteImages = new List <Image>();
            foreach (DTO.ImageDTO image in note.Images)
            {
                NoteImages.Add(new Image(image));
            }

            NoteLabels = new List <NoteLabel>();
            foreach (DTO.LabelDTO label in note.Labels)
            {
                AddLabel(label, dbContext);
            }
        }
Пример #2
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);
            }
        }