Exemple #1
0
        public async Task <IdentityResult> CreateAsync(UserDTO user, CancellationToken cancellationToken)
        {
            var userEntity = new UserEntity(user.Id, user.FirstName, user.LastName, user.Email, user.NormalizedEmail, user.EmailConfirmed, user.PasswordHash, user.BirthDate, user.RegistrationDate);

            return((!userEntity.HasMinimunAge())
                ? IdentityResult.Failed(new IdentityError()
            {
                Description = "The minimun age must be 18 or more"
            })
                : await _userIdentity.CreateAsync(userEntity, cancellationToken));
        }