Beispiel #1
0
        private static async void LoginUserRest(string username, string password)
        {
            var user = new User
            {
                USER_NAME = username,

                PASSWORD = password,
            };

            Dictionary <string, object> userRegisterPost = new Dictionary <string, object>
            {
                { "USER_NAME", user.USER_NAME },
                { "PASSWORD", user.PASSWORD },
            };


            IRestResponse restResponse = await _rest.PostRequest("v1/users/login", userRegisterPost);

            var userModel = ObjectBuilder.BuildUserObject(restResponse);

            if (userModel != null)
            {
                Console.WriteLine(userModel.USER_NAME);
            }
        }
        public async Task <User> RegisterUser(User user)
        {
            Dictionary <string, object> userRegisterPost = new Dictionary <string, object>
            {
                { "SURNAME", user.SURNAME },
                { "OTHER_NAMES", user.OTHER_NAMES },
                { "MOBILE", user.MOBILE },
                { "EMAIL", user.EMAIL },
                { "LOCATION_ID", user.LOCATION_ID },
                { "USER_NAME", user.USER_NAME },
                { "USER_TYPE", user.USER_TYPE },
                { "PASSWORD", user.PASSWORD },
                { "RESET_TOKEN", user.RESET_TOKEN },
                { "USER_STATUS", user.USER_STATUS },
                { "RETURN_MODEL", "YES" },
            };


            IRestResponse restResponse = await _rest.PostRequest("v1/users/register", userRegisterPost);

            var userModel = ObjectBuilder.BuildUserObject(restResponse);

            return(userModel);
        }