Example #1
0
        public ConferenceBuilder WithEndpoint(string displayName, string sipAddress, string defenceAdvocate = null)
        {
            var endpoint = new Endpoint(displayName, sipAddress, "1234", defenceAdvocate);

            _conference.AddEndpoint(endpoint);

            return(this);
        }
Example #2
0
        public async Task Handle(CreateConferenceCommand command)
        {
            var conference = new Conference(command.HearingRefId, command.CaseType, command.ScheduledDateTime,
                                            command.CaseNumber, command.CaseName, command.ScheduledDuration, command.HearingVenueName, command.AudioRecordingRequired, command.IngestUrl);

            foreach (var participant in command.Participants)
            {
                conference.AddParticipant(participant);
            }

            foreach (var endpoint in command.Endpoints)
            {
                conference.AddEndpoint(endpoint);
            }

            _context.Conferences.Add(conference);

            await _context.SaveChangesAsync();

            command.NewConferenceId = conference.Id;
        }
        public async Task Handle(CreateConferenceCommand command)
        {
            var conference = new Conference(command.HearingRefId, command.CaseType, command.ScheduledDateTime,
                                            command.CaseNumber, command.CaseName, command.ScheduledDuration, command.HearingVenueName, command.AudioRecordingRequired, command.IngestUrl);

            foreach (var participant in command.Participants)
            {
                conference.AddParticipant(participant);
            }

            foreach (var linkedParticipant in command.LinkedParticipants)
            {
                try
                {
                    var primaryParticipant =
                        conference.Participants.Single(x => x.ParticipantRefId == linkedParticipant.ParticipantRefId);

                    var secondaryParticipant =
                        conference.Participants.Single(x => x.ParticipantRefId == linkedParticipant.LinkedRefId);

                    primaryParticipant.AddLink(secondaryParticipant.Id, linkedParticipant.Type);
                }
                catch (Exception)
                {
                    throw new ParticipantLinkException(linkedParticipant.ParticipantRefId, linkedParticipant.LinkedRefId);
                }
            }

            foreach (var endpoint in command.Endpoints)
            {
                conference.AddEndpoint(endpoint);
            }

            _context.Conferences.Add(conference);

            await _context.SaveChangesAsync();

            command.NewConferenceId = conference.Id;
        }