Example #1
0
        public async Task <IdentityResult> CreateAsync(User user, CancellationToken cancellationToken)
        {
            if (user.Contact != null)
            {
                user.Contact = await _memberService.CreateContactAsync(user.Contact);
            }
            var dtoUser   = user.ToUserDto();
            var resultDto = await _platformSecurityApi.CreateAsync(dtoUser);

            return(resultDto.ToIdentityResult());
        }
Example #2
0
        public async Task <IdentityResult> CreateAsync(User user, CancellationToken cancellationToken)
        {
            var newContactCreated = false;

            if (user.Contact != null)
            {
                user.Contact = await _memberService.CreateContactAsync(user.Contact);

                newContactCreated = true;
            }

            var dtoUser   = user.ToUserDto();
            var resultDto = await _platformSecurityApi.CreateAsync(dtoUser);

            if (resultDto.Succeeded != true && newContactCreated)
            {
                await _memberService.DeleteContactAsync(user.Contact.Id);
            }

            return(resultDto.ToIdentityResult());
        }