public static List <AvailableAppointmentsDTO> AppointmentsToAvailableAppointmentsDTO(List <Appointment> appointments) { List <AvailableAppointmentsDTO> availableAppointmentsDTO = new List <AvailableAppointmentsDTO>(); foreach (Appointment appointmentIt in appointments) { AvailableAppointmentsDTO dto = new AvailableAppointmentsDTO { Start = appointmentIt.Period.StartTime, End = appointmentIt.Period.EndTime, }; availableAppointmentsDTO.Add(dto); } return(availableAppointmentsDTO); }
public static List <AvailableAppointmentsDTO> AppointmentsToAvailableAppointmentsDTOWithDoctor(List <Appointment> appointments) { List <AvailableAppointmentsDTO> availableAppointmentsDTO = new List <AvailableAppointmentsDTO>(); foreach (Appointment appointmentIt in appointments) { AvailableAppointmentsDTO dto = new AvailableAppointmentsDTO { Start = appointmentIt.Period.StartTime, End = appointmentIt.Period.EndTime, DoctorId = appointmentIt.DoctorId, DoctorFullName = appointmentIt.Doctor.Name + " " + appointmentIt.Doctor.Surname }; availableAppointmentsDTO.Add(dto); } return(availableAppointmentsDTO); }