Ejemplo n.º 1
0
        public static AppointmentDetails FromAppointment(Appointment appointment, int currentUserId, List <User> allParticipants)
        {
            IEnumerable <AppointmentParticipationInformation> withAnswers = appointment.AppointmentParticipations.Select(p => new AppointmentParticipationInformation(p.Participant.FullName, p.Participant.Id, p.AppointmentParticipationAnswer));

            IEnumerable <User> otherParticipants = allParticipants.Except(appointment.AppointmentParticipations.Select(a => a.Participant));
            IEnumerable <AppointmentParticipationInformation> noAnswers = otherParticipants.Select(p => new AppointmentParticipationInformation(p.FullName, p.Id, null));

            List <AppointmentParticipationInformation> participations = withAnswers.Concat(noAnswers).ToList();
            AppointmentInformation appointmentInformation             = AppointmentInformation.FromAppointment(appointment, currentUserId, allParticipants.Count);

            return(new AppointmentDetails(appointmentInformation, participations));
        }
Ejemplo n.º 2
0
        public static EventOverviewInformation FromEvent(Event @event, Appointment firstUpcomingAppointment, int currentUserId)
        {
            ViewEventInformation viewEventInformation = ViewEventInformation.FromEvent(@event, currentUserId);

            if (firstUpcomingAppointment == null)
            {
                return(new EventOverviewInformation(@event.Id, viewEventInformation, null));
            }

            AppointmentInformation appointmentInformation = AppointmentInformation.FromAppointment(firstUpcomingAppointment, currentUserId, @event.EventParticipations.Count);

            return(new EventOverviewInformation(@event.Id, viewEventInformation, appointmentInformation));
        }