Пример #1
0
        public IHttpActionResult Create([FromBody] UserCreateDto userModel)
        {
            var hash = _sha256Encryptor.ComputeHash(userModel.Password);

            var user = _usersRepository.Create(userModel.UserName, hash);

            _usersRepository.Save();

            return(Ok(user));
        }
Пример #2
0
        public tLoginInfo GetByUsernameAndPassword(string username, string password)
        {
            var hash = _sha256Encryptor.ComputeHash(password);

            var users = DbSet.Where(li => li.UserName == username).ToList();

            var user = users.FirstOrDefault(u => u.UserPassword.SequenceEqual(hash));

            return(user);
        }