Ejemplo n.º 1
0
        public bool AddAdminUser(string userName, string password)
        {
            AdminUserVModel vmodel = new AdminUserVModel
            {
                UserName = userName,
                Role     = "Administrator"
            };

            _adminService.AddAdminUser(vmodel, password);
            return(true);
        }
Ejemplo n.º 2
0
        public void AddAdminUser(AdminUserVModel vmodel, string password)
        {
            byte[] SHA256Data = Encoding.UTF8.GetBytes(password);

            SHA256Managed Sha256 = new SHA256Managed();

            byte[] by = Sha256.ComputeHash(SHA256Data);

            string     pwdHash = BitConverter.ToString(by).Replace("-", "").ToLower(); //64
            UserEntity entity  = new UserEntity
            {
                UserName = vmodel.UserName,
                Password = pwdHash,
                Role     = vmodel.Role
            };

            _userRepository.InsertUser(entity);
        }