public async Task <RegisterResult> Register(UserViewModel registerModel)
        {
            registerModel.Password = passwordHash.GetHash(registerModel.Password);
            var userModel = usersModelBuilder.GetUserModelByUserView(registerModel);
            await usersRepository.AddUser(userModel);

            return(new RegisterResult {
                Successful = true
            });
        }
        public async Task <UserModel> CheckUserDataByLoginViewModel(LoginViewModel loginModel)
        {
            var loggingUser = await usersRepository.GetUserByLogin(loginModel.Login);

            if (loggingUser == null)
            {
                return(null);
            }
            loginModel.Password = passwordHash.GetHash(loginModel.Password);
            if (loggingUser.Password == loginModel.Password)
            {
                return(loggingUser);
            }
            else
            {
                return(null);
            }
        }