예제 #1
0
        public User RegisterPerson(User newUserData)
        {
            var token  = _apiUserService.GetToken();
            var exists = _lookupService.EmailSearch(newUserData.email, token);

            if (exists != null && exists.Any())
            {
                throw (new DuplicateUserException(newUserData.email));
            }
            var householdRecordId = CreateHouseholdRecord(newUserData, token);
            var contactRecordId   = CreateContactRecord(newUserData, token, householdRecordId);
            var userRecordId      = CreateUserRecord(newUserData, token, contactRecordId);

            CreateUserRoleSubRecord(token, userRecordId);
            _participantService.CreateParticipantRecord(contactRecordId);
            CreateNewUserSubscriptions(contactRecordId, token);

            //TODO Contingent on cascading delete via contact
            //TODO Conisder encrypting the password on the user model
            return(newUserData);
        }