예제 #1
0
        public static Contracts.RegistrationAttempt Map(this RegistrationAttempt entity)
        {
            if (entity == null)
            {
                throw null;
            }

            return(new Contracts.RegistrationAttempt
            {
                Id = entity.Id,
                EmailAddress = entity.EmailAddress,
                FirstName = entity.FirstName,
                Surname = entity.Surname,
                HasSucceeded = entity.HasSucceeded,
                InitiativeId = entity.InitiativeId
            });
        }
        public Contracts.RegistrationAttempt CreateRegistration(Guid intiativeId, IUpdatableRegistration registration)
        {
            var entity = new RegistrationAttempt
            {
                Id           = Guid.NewGuid(),
                EmailAddress = registration.EmailAddress,
                FirstName    = registration.FirstName,
                Surname      = registration.Surname,
                HasSucceeded = false,
                InitiativeId = intiativeId
            };

            entity = InitiativesEntities.Instance.RegistrationAttempts.Add(entity);
            var result = entity.Map();

            InitiativesEntities.Instance.SaveChanges();

            Commit();
            return(result);
        }