Exemplo n.º 1
0
        public async Task <ActionResult <Participant> > PostAsync([FromRoute] int participantId, [Bind(ParticipantBindingFilter)] Participant participant, CancellationToken cancellationToken)
        {
            var result = await _context.Participants.FirstOrDefaultAsync(x => x.Id == participantId);

            if (result.IsRaised != participant.IsRaised || result.Name != participant.Name)
            {
                result.IsRaised = participant.IsRaised;
                result.Name     = participant.Name;
                await _context.SaveChangesAsync(cancellationToken);

                await _voteHub.ParticipantChanged(result, cancellationToken);
            }
            return(result);
        }