コード例 #1
0
        /// <summary>
        /// Sends request to Signup user
        /// </summary>
        /// <param name="username">New user username</param>
        /// <param name="pass">New user password</param>
        /// <param name="vertfyPass">New user verify password</param>
        /// <returns>Tuple task with boolean result and error message</returns>
        public async Task <Tuple <bool, string> > SignupAsync(string username, string pass, string vertfyPass)
        {
            Tuple <bool, string> userResult = null;
            User newUser;

            if (!pass.Equals(vertfyPass))
            {
                userResult = new Tuple <bool, string>(false, "Passwords didn't match");
            }
            else
            {
                newUser    = new User(username, pass);
                userResult = await mcRequests.Post("/api/User/CreateUser", newUser);
            }
            return(userResult);
        }
コード例 #2
0
        /// <summary>
        /// Calls REST API to add user
        /// </summary>
        /// <param name="user"></param>
        private void AddUser(string user)
        {
            RESTRequests rest   = new RESTRequests();
            var          result = rest.Post("/api/User/CreateUser", new User(user, "testPass"));

            result.Wait();
        }