Пример #1
0
        public Task CreateAsync(MyUser user)
        {
            List <string> errors     = new List <string>();
            var           userEntity = new User()
            {
                Firstname     = user.Firstname,
                Lastname      = user.Lastname,
                Phone         = user.Phone,
                UserName      = user.UserName,
                Email         = user.Email,
                Password      = user.Password,
                Active        = user.Active,
                SecurityStamp = user.SecurityStamp,
                EmailVerified = false,
                PhoneVerified = false,
                CreatedOn     = DateTime.Now,
                Deleted       = false
            };
            var userRecord = _userService.CreateUser(userEntity);
            var userID     = Convert.ToInt64(userRecord.Id);

            if (userID > 0)
            {
                return(Task.FromResult(IdentityResult.Success));
            }
            else
            {
                errors.Add($"Create Ueser Failed,User Name:{user.UserName}");
                return(Task.FromResult(IdentityResult.Failed(errors.ToArray())));
            }
        }
Пример #2
0
        public Task CreateAsync(MyUser user)
        {
            var userEntity = new User()
            {
                Firstname     = user.Firstname,
                Lastname      = user.Lastname,
                Phone         = user.Phone,
                UserName      = user.UserName,
                Password      = user.Password,
                Active        = user.Active,
                SecurityStamp = user.SecurityStamp,
                EmailVerified = false,
                PhoneVerified = false,
                CreatedOn     = DateTime.Now,
                Deleted       = false
            };

            _userService.CreateUser(userEntity);
            return(Task.FromResult(0));
        }