public DoctorDTO GetDoctorByNIN(string doctorNIN) { var returnedDoctor = DoctorContext.spGetDoctorByNIN(doctorNIN).FirstOrDefault(); if (returnedDoctor == null) { return(null); } DoctorDTO doctorDTO = new DoctorDTO(); doctorDTO.DoctorEmail = returnedDoctor.DoctorEmail; doctorDTO.DoctorName = returnedDoctor.DoctorName; doctorDTO.DoctorPhoneNumber = returnedDoctor.DoctorPhoneNumber; doctorDTO.DoctorPosition = returnedDoctor.DoctorPosition; doctorDTO.DoctorUIN = returnedDoctor.DoctorUIN; doctorDTO.DoctorNIN = returnedDoctor.DoctorNIN; doctorDTO.Id = returnedDoctor.ID; doctorDTO.HealthcareFacilityId = returnedDoctor.HealthcareFacilityId; var healthCareFacilitiesService = new HealthCareFacilitiesService(); var facility = healthCareFacilitiesService.GetFacilityByID(returnedDoctor.HealthcareFacilityId); doctorDTO.HealthcareFacilityName = facility; return(doctorDTO); }
public DoctorDTO GetDoctorByID(int doctorID) { var returnedDoctor = DoctorContext.doctors_table.Find(doctorID); if (returnedDoctor == null) { return(null); } DoctorDTO doctorDTO = new DoctorDTO(); doctorDTO.DoctorEmail = returnedDoctor.DoctorEmail; doctorDTO.DoctorName = returnedDoctor.DoctorName; doctorDTO.DoctorPhoneNumber = returnedDoctor.DoctorPhoneNumber; doctorDTO.DoctorPosition = returnedDoctor.DoctorPosition; doctorDTO.DoctorUIN = returnedDoctor.DoctorUIN; doctorDTO.DoctorNIN = returnedDoctor.DoctorNIN; doctorDTO.Id = returnedDoctor.ID; doctorDTO.HealthcareFacilityId = returnedDoctor.HealthcareFacilityId; var healthCareFacilitiesService = new HealthCareFacilitiesService(); var facility = healthCareFacilitiesService.GetFacilityByID(returnedDoctor.HealthcareFacilityId); doctorDTO.HealthcareFacilityName = facility; return(doctorDTO); }