Ejemplo n.º 1
0
        public async Task <bool> CreatUserAsync(RegisterDto model)
        {
            if (await IsExists(model.UserName))
            {
                _logger.LogWarning($"用户名:{model.UserName} 已存在。");
                return(false);
            }
            var pwd  = _generalService.EncryptPassword(model.Password);
            var user = new IdentityUser {
                UserName = model.UserName, Id = Guid.NewGuid(), Password = pwd, Email = model.Email, CustomTag = model.CustomTag, RegTime = DateTime.Now
            };

            return(await _userRepository.AddAsync(user));
        }