コード例 #1
0
        /// <summary>
        /// Creates the specified <paramref name="user" /> in the user store.
        /// </summary>
        /// <param name="user">The user to create.</param>
        /// <param name="cancellationToken">The <see cref="T:System.Threading.CancellationToken" /> used to propagate notifications that the operation should be canceled.</param>
        /// <returns>The <see cref="T:System.Threading.Tasks.Task" /> that represents the asynchronous operation, containing the <see cref="T:Microsoft.AspNetCore.Identity.IdentityResult" /> of the creation operation.</returns>
        public async Task <IdentityResult> CreateAsync(IdentityUser user, CancellationToken cancellationToken)
        {
            var puser = new PortalUser();

            user.CopyTo(puser);

            if (puser.PortalUserID == Guid.Empty)
            {
                puser.PortalUserID = Guid.NewGuid();
            }

            await SaveNew(puser);

            puser.CopyTo(user);
            return(IdentityResult.Success);
        }