예제 #1
0
        public static MEDoctor ToMEDoctor(this DoctorViewModel dto)
        {
            MEDoctor entity = new MEDoctor();

            entity.CopyPropertiesFrom(dto);
            return(entity);
        }
        public static ShortDoctorDto ToShortDoctorDto(this MEDoctor entity)
        {
            if (entity == null)
            {
                return(null);
            }
            ShortDoctorDto dto = new ShortDoctorDto();

            dto.CopyPropertiesFrom(entity);
            return(dto);
        }
        public static DoctorViewModel ToDoctorViewModel(this MEDoctor entity)
        {
            if (entity == null)
            {
                return(null);
            }

            DoctorViewModel dto = new DoctorViewModel();

            dto.CopyPropertiesFrom(entity);
            dto.MEDoctorID = entity.MEDoctorID;
            return(dto);
        }
        public static DoctorViewModel ToDoctorViewModel(this MEDoctor entity, SpecialistViewModel[] specialists)
        {
            if (entity == null)
            {
                return(null);
            }

            DoctorViewModel dto = new DoctorViewModel();

            dto.CopyPropertiesFrom(entity);
            dto.MEDoctorID      = entity.MEDoctorID;
            dto.Specialists     = specialists;
            dto.MESpecialistIds = specialists.Select(x => x.MESpecialistID.ToString()).ToArray();
            return(dto);
        }