public async Task <IActionResult> Post([FromBody] Models.Participants model)
        {
            String Error = ValidateInput(model);

            if (!String.IsNullOrEmpty(Error))
            {
                return(BadRequest(Error));
            }


            var entity = await repository.AddAsync(model);


            return(CreatedAtRoute("GetParticipantByID", new { id = entity.id }, entity));
        }
Пример #2
0
        public async Task HandleAsync(TicketPurchased @event)
        {
            var participant = await _participantsRepository.GetAsync(@event.ConferenceId, @event.UserId);

            if (participant is not null)
            {
                return;
            }

            participant = new Participant(Guid.NewGuid(), @event.ConferenceId, @event.UserId);
            await _participantsRepository.AddAsync(participant);

            _logger.LogInformation($"Added a participant with ID: '{participant.Id}' " +
                                   $"for conference: '{participant.ConferenceId}', user: '******'.");
        }