Ejemplo n.º 1
0
        public async Task <ActionResult <RegistrationDto> > CreateNewRegistration(
            [FromBody] NewRegistrationDto dto,
            CancellationToken cancellationToken)
        {
            try
            {
                var registration = await _registrationManagementService.CreateRegistrationAsync(dto.EventId, dto.UserId, dto.CopyTo, cancellationToken);

                return(Ok(new RegistrationDto(registration)));
            }
            catch (DuplicateException)
            {
                var registration = await _registrationRetrievalService.FindRegistrationAsync(new RegistrationFilter
                {
                    EventInfoId = dto.EventId,
                    UserId      = dto.UserId
                }, null, cancellationToken);

                return(Ok(new RegistrationDto(registration)));
            }
        }
Ejemplo n.º 2
0
        public async Task <ActionResult <RegistrationDto> > CreateNewRegistration(
            [FromBody] NewRegistrationDto dto,
            CancellationToken cancellationToken)
        {
            var registration =
                await _registrationManagementService.CreateRegistrationAsync(dto.EventId, dto.UserId,
                                                                             new RegistrationOptions
            {
                CreateOrder = dto.CreateOrder
            },
                                                                             cancellationToken);

            if (!dto.Empty)
            {
                dto.CopyTo(registration);
                await _registrationManagementService
                .UpdateRegistrationAsync(registration, cancellationToken);
            }

            return(Ok(new RegistrationDto(registration)));
        }