public void SaveFillerForm()
        {
            var mapDto = new QuestionAnswerMappingDTO()
            {
                EntityStateDTO = EntityStateDTO.Added,
                Client         = "Client",
                NoteDTO        = new NoteDTO {
                    Id = 1, Title = "TrackableNote2"
                },                                                          //existing id
                AcpAnswerDTO = new AcpAnswerDTO()
                {
                    EntityStateDTO         = EntityStateDTO.Added,
                    AnswerText             = "NewAnswer",
                    AcpQuestionListItemDTO = new AcpQuestionListItemDTO()
                    {
                        Name = "NewAcpQuestionListItem"
                    }
                }
            };

            var fillerForm = new FillerFormDTO()
            {
                EntityStateDTO         = EntityStateDTO.Added,
                QuestionAnswerMappings = new List <QuestionAnswerMappingDTO>
                {
                    mapDto
                },
                Name = "Filler",
            };

            _notesService.SaveFiller(fillerForm);
        }
        public void EditFiller(FillerFormDTO fillerFormDTO)
        {
            fillerFormDTO.QuestionAnswerMappings.ForEach(x => x.EntityStateDTO = EntityStateDTO.Modified);

            _unitOfWork.BeginTransaction();

            try
            {
                //
                var questionAnswerMapping = _questionAnswerMapRepo.Find(1); //this helps to rehidtrate the context with acpQAMap
                var acpQAnsMap            = new QuestionAnswerMapping();
                acpQAnsMap.Id              = 1;                             //existing id
                acpQAnsMap.Client          = "Newclient7";
                acpQAnsMap.EntityState     = EntityState.Modified;
                acpQAnsMap.FK_FillerFormId = questionAnswerMapping.FK_FillerFormId;

                _questionAnswerMapRepo.Update(acpQAnsMap);


                //
                var answerE           = _acpAnswerRepo.Find(1);       //this helps to rehidtrate the context with acpAnswer
                var questionListItemE = _acpQuesListItemRepo.Find(5); //the eixting we want to update - first hidrate it into context

                //var questionLstItm = new AcpQuestionListItem()
                //{
                //    Id = 5,
                //    EntityState = EntityState.Unchanged,
                //};

                //_acpQuesListItemRepo.Attach(questionListItemE);

                var answer = new AcpAnswer
                {
                    Id                  = 1,
                    EntityState         = EntityState.Modified,
                    AnswerText          = "answer8",
                    AcpQuestionListItem = questionListItemE
                };


                _acpAnswerRepo.Update(answer);



                _unitOfWork.Save();
                _unitOfWork.Commit();
            }
            catch (Exception)
            {
                _unitOfWork.Rollback();
            }
        }
        public void EditFillerForm()
        {
            var mapDto = new QuestionAnswerMappingDTO()
            {
                Client  = "ClientEdited",
                NoteDTO = new NoteDTO {
                    Id = 1, Title = "Bar"
                }                                               //existing id
            };

            var fillerForm = new FillerFormDTO()
            {
                QuestionAnswerMappings = new List <QuestionAnswerMappingDTO>
                {
                    mapDto
                },
                Name = "Filler",
            };

            _notesService.EditFiller(fillerForm);
        }
        public void SaveFiller(FillerFormDTO fillerFormDTO)
        {
            _unitOfWork.BeginTransaction();

            try
            {
                var fillerFormEntity = new FillerForm()
                {
                    EntityState            = EntityState.Added,
                    Name                   = fillerFormDTO.Name,
                    QuestionAnswerMappings = GetMappings(fillerFormDTO.QuestionAnswerMappings).ToList()
                };
                _fillerFormRepo.Add(fillerFormEntity);
                _unitOfWork.Save();
                _unitOfWork.Commit();
            }
            catch (Exception)
            {
                _unitOfWork.Rollback();
            }
        }