Пример #1
0
        public User GetUser(string apiName, string usernameKey, string passwordKey)
        {
            var username = _settingsService.GetSetting <string>(usernameKey);

            if (string.IsNullOrEmpty(username))
            {
                username = _inputService.AskForInput($"Please provide your username for {apiName}");
                _settingsService.SaveSetting(usernameKey, username);
            }

            var password = _settingsService.GetSetting <string>(passwordKey);

            if (string.IsNullOrEmpty(password))
            {
                password = _inputService.AskForPassword($"Please provide your password for {apiName}");
                _settingsService.SaveSetting(passwordKey, password);
            }

            return(new User
            {
                Username = username,
                Password = password
            });
        }