public Result<PatientMedicalNoteDto> GetPatientMedicalNotes(int patientConsultationId)
        {
            Result<PatientMedicalNoteDto> response = new Result<PatientMedicalNoteDto>();

            using (UnitOfWork unitOfWork = new UnitOfWork())
            {
                IEnumerable<MedicalNote> medicalNotes = unitOfWork.MedicalNoteRepository.GetEntities();
                IEnumerable<PatientMedicalNote> patientMedicalNotes = unitOfWork.PatientMedicalNoteRepository.GetEntities(item => item.PatientConsultationId == patientConsultationId, p => p.OrderBy(o => o.MedicalNote.SortKey));

                foreach (MedicalNote medicalNote in medicalNotes)
                {
                    MedicalNoteDto medicalNoteDto = _MedicalNoteMapper.MapToMedicalNoteDto(medicalNote);
                    PatientMedicalNote patientMedicalNote = patientMedicalNotes.Where(item => item.MedicalNoteId == medicalNote.MedicalNoteId).FirstOrDefault();

                    PatientMedicalNoteDto patientMedicalNoteDto = new PatientMedicalNoteDto()
                    {
                        PatientMedicalNoteId = patientMedicalNote == null ? default(int?) : patientMedicalNote.PatientMedicalNoteId,
                        PatientConsultationId = patientConsultationId,
                        MedicalNote = medicalNoteDto,
                        Value = patientMedicalNote == null ? null : patientMedicalNote.Value
                    };

                    response.Models.Add(patientMedicalNoteDto);
                }
            }

            return response;
        }
        public MedicalNoteDto MapToMedicalNoteDto(MedicalNote medicalNote)
        {
            if (medicalNote == null)
            {
                return(null);
            }

            MedicalNoteDto medicalNoteDto = new MedicalNoteDto();

            medicalNoteDto.MedicalNoteId = medicalNote.MedicalNoteId;
            medicalNoteDto.Name          = medicalNote.Name;
            medicalNoteDto.SortKey       = medicalNote.SortKey;

            return(medicalNoteDto);
        }
        public MedicalNote MapToMedicalNote(MedicalNoteDto medicalNoteDto)
        {
            if (medicalNoteDto == null)
            {
                return(null);
            }

            MedicalNote medicalNote = new MedicalNote();

            if (medicalNoteDto.MedicalNoteId != null)
            {
                medicalNote.MedicalNoteId = medicalNoteDto.MedicalNoteId.Value;
            }

            medicalNote.Name    = medicalNoteDto.Name;
            medicalNote.SortKey = medicalNoteDto.SortKey;

            return(medicalNote);
        }