private static List <PriceName> GetParticipantPriceNames(CourseTemplateEvent currentEvent) { return(currentEvent?.PriceNames.Select(x => new PriceName { PriceNameId = x.PriceNameId ?? 0, Description = x.PriceNameDescription, Price = x.Price ?? 0 }).ToList()); }
private static List <Session> GetParticipantSessions(CourseTemplateEvent currentEvent) { return(currentEvent?.Sessions.Select(x => new Models.Booking.Session { EndDate = x.EndDate?.LocalDateTime ?? new DateTime(), Name = string.IsNullOrWhiteSpace(x.SessionName) ? x.SessionName : x.InternalSessionName, Participating = x.MandatoryParticipation ?? false, Price = x.PriceNames?.FirstOrDefault()?.Price ?? 0, PriceNameId = x.PriceNames?.FirstOrDefault()?.PriceNameId ?? 0, StartDate = x.StartDate?.LocalDateTime ?? new DateTime(), SessionId = x.SessionId ?? 0 }).ToList()); }
private static List <Models.Participant> GetAndSetParticipants(CourseTemplateEvent currentEvent, CourseTemplate courseTemplate, List <Question> participantQuestions) { return(new List <Models.Participant> { new Models.Participant { RequireCivicRegistrationNumber = courseTemplate.RequireCivicRegistrationNumber ?? false, PriceNames = GetParticipantPriceNames(currentEvent), Sessions = GetParticipantSessions(currentEvent), ParticipantQuestions = participantQuestions } }); }