Beispiel #1
0
        public QuestionAnswerMappingDTO()
        {
            NoteDTO = new NoteDTO();

            AcpAnswerDTO = new AcpAnswerDTO();

            FillerFormDTO = new FillerFormDTO();
        }
        public int Delete(NoteDTO noteDomain, bool disableSoftDelete = false)
        {
            var noteToSave = noteDomain.ConvertToDomain();

            if (disableSoftDelete)
            {
                _noteRepo.Delete(noteToSave);
            }
            else
            {
                noteDomain.MarkAsDeleted = true;
                _noteRepo.Update(noteToSave);
            }
            return _unitOfWork.Save();
        }
Beispiel #3
0
 public static Note ConvertToDomain(this NoteDTO note)
 {
     return(new Note
     {
         Id = note.Id,
         Title = note.Title,
         Description = note.Description,
         EntityState = ConvertState(note.EntityStateDTO),
         IsActive = note.IsActive,
         NoteVersions = note.NoteVersions.Select(x => new NoteVersion()
         {
             Name = x.Name,
             Version = x.Version,
             EntityState = ConvertState(x.EntityStateDTO),
             NoteSection = x.NoteSection.Select(dto => dto.ConvertToDomain()).ToList(),
         }).ToList()
     });
 }
        public QuestionAnswerMappingDTO()
        {
            NoteDTO = new NoteDTO();

                AcpAnswerDTO = new AcpAnswerDTO();

                FillerFormDTO = new FillerFormDTO();
        }
        public NoteVersionDTO()
        {
            NoteDTO = new NoteDTO();

              NoteSection = new System.Collections.Generic.List<NoteSectionDTO>();
        }
        public void TrackableTransaction()
        {
            //Add new note
            var noteDto = new NoteDTO()
            {
                EntityStateDTO = EntityStateDTO.Added,
                Title = "TrackableNote1",
                NoteVersions = new List<NoteVersionDTO>
                {
                    new NoteVersionDTO()
                    {
                        EntityStateDTO = EntityStateDTO.Added,
                        Name = "vT", Version = 99,
                         NoteSection = new List<NoteSectionDTO>
                        {
                            new NoteSectionDTO()
                            {
                                EntityStateDTO = EntityStateDTO.Added,
                                SectionColor = "Blue",
                                SectionName = "Ship",
                            }
                        }
                    }
                }
            };

            _notesService.Save(noteDto);

            //Get added note to get the id
            var note = _notesService.FindByTitle(noteDto.Title);

            //Set id and update the existing note
            noteDto.Title = "TrackableNote2";
            noteDto.EntityStateDTO = EntityStateDTO.Modified;
            noteDto.Id = note.Id;
            //noteDto.Id = newId;

            _notesService.Update(noteDto);
        }
 public int Update(NoteDTO noteToUpdate)
 {
     var noteEntity = new Note();
     noteEntity.InjectFrom<LoopValueInjection>(noteToUpdate);
     noteEntity.InjectFrom<MapEnum>(new { EntityState = noteToUpdate.EntityStateDTO });
     _noteRepo.Update(noteEntity);
     return _unitOfWork.Save();
 }
 public void Save(NoteDTO noteToSaveDTO)
 {
     //var noteToSave = noteToSaveDTO.ConvertToDomain();
     var noteEntity = new Note();
     noteEntity.InjectFrom<LoopValueInjection>(noteToSaveDTO);
     noteEntity.InjectFrom<MapEnum>(new { EntityState = noteToSaveDTO.EntityStateDTO });
     noteEntity.EntityState = EntityState.Added;
     _noteRepo.Add(noteEntity);
     _unitOfWork.Save();
 }
 public NoteDTO FindByTitle(string title)
 {
     var domain = _noteRepo.Find(x => x.Title == title);
     var dto = new NoteDTO();
     dto.InjectFrom(domain);
     return dto;
 }
        public NoteDTO FindById(int id)
        {
            var domain = _noteRepo.Find(id);

            var dto = new NoteDTO();
            dto.InjectFrom(domain);
            return dto;
        }
Beispiel #11
0
        public NoteVersionDTO()
        {
            NoteDTO = new NoteDTO();

            NoteSection = new System.Collections.Generic.List <NoteSectionDTO>();
        }