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(); } }
private IList <QuestionAnswerMapping> GetMappingsEdit(IEnumerable <QuestionAnswerMappingDTO> dtos, FillerForm fillerForm) { var list = new List <QuestionAnswerMapping>(); foreach (var questionAnswerMappingDto in dtos) { list.Add(new QuestionAnswerMapping() { Id = 3, Client = questionAnswerMappingDto.Client, EntityState = EntityState.Modified, Note = GetExistingNote(questionAnswerMappingDto.NoteDTO.Id), FillerForm = fillerForm }); } return(list); }