Exemplo n.º 1
0
        public IDataResult <SystemUser> Register(SystemUserForRegisterDto systemUserForRegisterDto, string password)
        {
            byte[] passwordHash, passwordSalt;
            HashingHelper.CreatePasswordHash(password, out passwordHash, out passwordSalt);
            var systemUser = new SystemUser
            {
                Email        = systemUserForRegisterDto.Email,
                FirstName    = systemUserForRegisterDto.FirstName,
                LastName     = systemUserForRegisterDto.LastName,
                PasswordHash = passwordHash,
                PasswordSalt = passwordSalt,
                Status       = true
            };

            _systemUserService.Add(systemUser);
            return(new SuccessDataResult <SystemUser>(systemUser, Messages.UserRegistered));
        }
Exemplo n.º 2
0
 public IActionResult AddUserTest()
 {
     try
     {
         SystemUser systemUser = new SystemUser
         {
             Id       = Guid.NewGuid().ToString(),
             AddTime  = DateTime.Now,
             IsLock   = false,
             IsDelete = false,
             UserName = "******",
             Password = "******"
         };
         _systemUserService.Add(systemUser);
         _unitOfWork.Commit();
         return(Ok(Newtonsoft.Json.JsonConvert.SerializeObject(systemUser)));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }