Example #1
0
        public ActionResult Create([Bind] Registration registration)
        {
            registrationRepository.Create(registration);

            TempData["Message"] = "Registration.RegistrationCreated";
            return(View("Success"));
        }
Example #2
0
        public void Subscribe(string emailAddress)
        {
            var registration = new Registration(emailAddress);
            var rowsAffected = _registrationRepository.Create(registration);

            if (rowsAffected == 0)
            {
                return;
            }
            var email = new ConfirmationEmail(emailAddress, registration.VerificationCode);

            _emailService.Send(email);
        }
        public async Task <ActionResult> CreateRegistration([FromBody] RegistrationCreate request)
        {
            if (ModelState.IsValid)
            {
                var registrationDto = request.ToDto();
                await _context.Create(registrationDto);

                return(Ok());
            }
            else
            {
                return(BadRequest("model validation failed"));
            }
        }
Example #4
0
        public void Register(RegisterModel model)
        {
            Guard.NotNull(model, nameof(model), Constants.NullExceptionGenerator);
            _logger.LogInformation($"new registration: {JsonConvert.SerializeObject(model)}");

            var entity = Mapper.Map <Registration>(model);

            entity.Children
            .SelectMany(x => x.Events)
            .ToList()
            .ForEach(x =>
                     x.EventSnapshot = _eventAccessor.GetSnapshot(x.EventId));

            SetPaymentAmount(entity);
            _repository.Create(entity);
        }