Пример #1
0
        public async Task <int> Register(string fullname, string email, int[] favoriteIntegers, DateTime dateOfBirth, bool emailOptIn, DateTime timeOfRegistration)
        {
            var dto = new RegistrantDto
            {
                FullName             = fullname,
                Email                = email,
                EmailOptIn           = emailOptIn,
                DateOfBirth          = dateOfBirth,
                FavoriteIntegers     = favoriteIntegers,
                RegistrationDateTime = timeOfRegistration
            };

            return(await _registrationRepository.CreateRegistration(_mapper.Map <Registrant>(dto)));
        }
Пример #2
0
        private int Registration(MinistryPlatform.Translation.Models.GoCincinnati.MpRegistration registrationDto)
        {
            int registrationId;

            try
            {
                registrationId = _registrationService.CreateRegistration(registrationDto);
            }
            catch (Exception ex)
            {
                _logger.Error("GO Volunteer Service - Create Registration (Create Registration)", ex);
                throw;
            }
            return(registrationId);
        }
Пример #3
0
        public async Task <ActionResult <Registration> > CreateRegistration(int portalId,
                                                                            [FromBody] RegistrationModel registration)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            Event registeredEvent = await _eventRepository.GetEventById(portalId, registration.EventId);

            registration.Event = registeredEvent;

            Registration newRegistration = await _registrationRepository.CreateRegistration(portalId, registration);

            return(Ok(newRegistration));
        }
        private async Task <Registration> Register(int portalId, CamperOverrideModel camper, Event dbEvent,
                                                   int?paymentId)
        {
            Camper dbCamper = await _camperRepository.CreateCamper(portalId, camper);

            if (!string.IsNullOrEmpty(camper.Coupon))
            {
                IEnumerable <Coupon> dbCoupons = await _couponRepository.GetCouponsByCode(portalId, camper.Coupon);

                List <Coupon> coupons = dbCoupons.ToList();

                if (coupons.Any())
                {
                    await _redeemedCouponRepository.RedeemCoupon(coupons.First().Id, dbCamper.Id);
                }
            }

            await SaveCustomFields(dbCamper.Id, camper.CustomFields);

            RegistrationModel registrationModel = new RegistrationModel
            {
                Event           = dbEvent,
                EventId         = dbEvent.Id,
                CamperId        = dbCamper.Id,
                IsActive        = true,
                StartingBalance = camper.StartingBalance,
            };

            Registration registration = await _registrationRepository.CreateRegistration(portalId, registrationModel);

            if (paymentId != null)
            {
                await _paymentDonationRepository.AddRegistrationPayment(paymentId.Value, registration.Id);
            }

            return(registration);
        }