Пример #1
0
        /// <summary>
        /// Sign Up Method
        /// </summary>
        public ResultSet SignUpOperation()
        {
            bool      tryAgain = true;
            ResultSet result   = null;

            while (tryAgain)
            {
                Console.WriteLine("Please Enter Username:"******"Please Enter Password:"******"Please specify valid username");
                    continue;
                }

                if (string.IsNullOrEmpty(password))
                {
                    Console.WriteLine("Please specify valid password");
                    continue;
                }

                User user = new User(userName, password);

                try
                {
                    //Save User To Json DB
                    result = _dbQuery.AddUser(user);
                }
                catch (Exception ex)
                {
                    Log.Error(ex.Message);
                }

                if (result.Status != Status.Success)
                {
                    if (GeneralHelper.CheckIfType <string>(result.ReturnResult))
                    {
                        Console.WriteLine(result.ReturnResult.ToString());
                    }
                }
                else
                {
                    tryAgain = false;
                }
            }

            return(result);
        }