Example #1
0
        public async Task <ActionResult <Participant> > PostJoinParticipantToRoomAsync([FromRoute] int roomId, [Bind(ParticipantController.ParticipantBindingFilter)] Participant participant, CancellationToken cancellationToken)
        {
            participant.RoomId = roomId;
            if (!await _context.Rooms.AnyAsync(x => x.Id == roomId))
            {
                return(BadRequest());
            }
            _context.Participants.Add(participant);
            await _context.SaveChangesAsync(cancellationToken);

            await _voteHub.ParticipantJoined(participant, cancellationToken);

            return(participant);
        }