public async Task <IList <AgendaAppointmentDTO> > GetUserAgendaAppointment(User user) { var list = _agendaRepository.GetUserAgendaAppointment(user); return(list.Select(o => new AgendaAppointmentDTO { ID = o.ID, Date = o.DateSchedule, Professional = o.AgendaSchedule.Agenda.Professional.User.PersonalInfo.Name, AppointmentType = o.AgendaSchedule.Agenda.AppointmentType.Name, BeginTime = AgendaRepository.ConvertMinutesToDateTime(o.DateSchedule, o.BeginTime).ToString("HH:mm"), EndTime = AgendaRepository.ConvertMinutesToDateTime(o.DateSchedule, o.EndTime).ToString("HH:mm"), Status = o.Status.GetHashCode() }).ToList()); }
public async Task <IList <ProfessionalScheduleDTO> > GetProfessionalUserSchedules(User user, DateTime date) { var list = _agendaRepository.GetProfessionalUserSchedules(user, date); list = list.OrderBy(o => o.DateSchedule).ThenBy(o => o.BeginTime).ToList(); return(list.Select(o => new ProfessionalScheduleDTO { ID = o.ID, Date = o.DateSchedule, Patient = o.User.PersonalInfo.Name, PhotoUrl = !string.IsNullOrEmpty(o.User.PersonalInfo.SrcPhoto) ? o.User.PersonalInfo.SrcPhoto : PersonalInfo.DEFAULT_PHOTO_URL, AppointmentType = o.AgendaSchedule.Agenda.AppointmentType.Name, BeginTime = AgendaRepository.ConvertMinutesToDateTime(o.DateSchedule, o.BeginTime).ToString("HH:mm"), EndTime = AgendaRepository.ConvertMinutesToDateTime(o.DateSchedule, o.EndTime).ToString("HH:mm"), Status = o.Status.GetHashCode() }).ToList()); }