示例#1
0
        // Add another user to your circle
        public static void AddUser(int circleId, int userprofileId)
        {
            var client   = new RestClient("http://circlesapitwoapp.azurewebsites.net/api/");
            var request  = new RestRequest("circles/" + circleId + "/userprofiles/" + userprofileId, Method.POST);
            var response = new RestResponse();

            Task.Run(async() =>
            {
                response = await GetAsyncResponse.GetResponseContentAsync(client, request) as RestResponse;
            }).Wait();
        }
示例#2
0
        // Delete particular Circle
        public static void DeleteCircle(int id)
        {
            var client   = new RestClient("http://localhost:5000/api/");
            var request  = new RestRequest("circles/" + id, Method.DELETE);
            var response = new RestResponse();

            Task.Run(async() =>
            {
                response = await GetAsyncResponse.GetResponseContentAsync(client, request) as RestResponse;
            }).Wait();
        }
示例#3
0
        // Delete particular Circle
        public static void DeleteCircle(int id)
        {
            var client   = new RestClient("http://circlesapitwoapp.azurewebsites.net/api/");
            var request  = new RestRequest("circles/" + id, Method.DELETE);
            var response = new RestResponse();

            Task.Run(async() =>
            {
                response = await GetAsyncResponse.GetResponseContentAsync(client, request) as RestResponse;
            }).Wait();
        }
示例#4
0
        // Remove user from your circle
        public static void RemoveUser(int id)
        {
            Console.WriteLine("ID IN REMOVE USER in api call  IS: " + id);
            var client   = new RestClient("http://circlesapitwoapp.azurewebsites.net/api/");
            var request  = new RestRequest("circleuserprofiles/" + id, Method.DELETE);
            var response = new RestResponse();

            Task.Run(async() =>
            {
                response = await GetAsyncResponse.GetResponseContentAsync(client, request) as RestResponse;
            }).Wait();
        }
        public static void CreateUserProfile(Userprofile userprofile)
        {
            var client = new RestClient("http://circlesapiserver.azurewebsites.net/api/");
            var request = new RestRequest("userprofiles/", Method.POST);
            request.AddJsonBody(userprofile);
            var response = new RestResponse();

            Task.Run(async () =>
            {
                response = await GetAsyncResponse.GetResponseContentAsync(client, request) as RestResponse;
            }).Wait();
        }
示例#6
0
        // Editing a particular Circle
        public static void EditCircle(int id, Circle circle)
        {
            var client = new RestClient("http://circlesapiserver.azurewebsites.net/api/");
            var request = new RestRequest("circles/" + id, Method.PUT);
            request.AddJsonBody(circle);
            var response = new RestResponse();

            Task.Run(async () =>
            {
                response = await GetAsyncResponse.GetResponseContentAsync(client, request) as RestResponse;
            }).Wait();
        }
示例#7
0
        // Add new Circle
        public static void CreateCircle(Circle circle)
        {
            var client  = new RestClient("http://circlesapitwoapp.azurewebsites.net/api/");
            var request = new RestRequest("circles", Method.POST);

            request.AddJsonBody(circle);
            var response = new RestResponse();

            Task.Run(async() =>
            {
                response = await GetAsyncResponse.GetResponseContentAsync(client, request) as RestResponse;
            }).Wait();
        }
示例#8
0
        public static void EditUserprofile(int id, Userprofile userprofile)
        {
            var client  = new RestClient("http://localhost:5000/api/");
            var request = new RestRequest("userprofiles/" + id, Method.PUT);

            request.AddJsonBody(userprofile);
            var response = new RestResponse();

            Task.Run(async() =>
            {
                response = await GetAsyncResponse.GetResponseContentAsync(client, request) as RestResponse;
            }).Wait();
        }
        public static List<Userprofile> GetAllUserprofiles()
        {
            var client = new RestClient("http://circlesapiserver.azurewebsites.net/api/");
            var request = new RestRequest("userprofiles/", Method.GET);
            var response = new RestResponse();

            Task.Run(async () =>
            {
                response = await GetAsyncResponse.GetResponseContentAsync(client, request) as RestResponse;
            }).Wait();

            JArray jsonResponse = JsonConvert.DeserializeObject<JArray>(response.Content);
            var userprofileList = JsonConvert.DeserializeObject<List<Userprofile>>(jsonResponse.ToString());
            return userprofileList;
        }
        public static Userprofile GetThisUserprofile(int id)
        {
            var client = new RestClient("http://circlesapiserver.azurewebsites.net/api/");
            var request = new RestRequest("userprofiles/" + id, Method.GET);
            var response = new RestResponse();

            Task.Run(async () =>
            {
                response = await GetAsyncResponse.GetResponseContentAsync(client, request) as RestResponse;
            }).Wait();

            JObject jsonResponse = JsonConvert.DeserializeObject<JObject>(response.Content);
            var thisUserprofile = JsonConvert.DeserializeObject<Userprofile>(jsonResponse.ToString());
            return thisUserprofile;
        }
示例#11
0
        // Display next page of circles
        // public static List<Circle> GetNextCircles()
        // {
        //     var client = new RestClient("http://localhost:5000/api/");
        //     var request = new RestRequest("circles/next", Method.GET);
        //     var response = new RestResponse();

        //     Task.Run(async () =>
        //     {
        //         response = await GetAsyncResponse.GetResponseContentAsync(client, request) as RestResponse;
        //     }).Wait();

        //     JArray jsonResponse = JsonConvert.DeserializeObject<JArray>(response.Content);
        //     var circleList = JsonConvert.DeserializeObject<List<Circle>>(jsonResponse.ToString());
        //     return circleList;
        // }

        // // Display prev page of circles
        // public static List<Circle> GetPrevCircles()
        // {
        //     var client = new RestClient("http://localhost:5000/api/");
        //     var request = new RestRequest("circles/prev", Method.GET);
        //     var response = new RestResponse();

        //     Task.Run(async () =>
        //     {
        //         response = await GetAsyncResponse.GetResponseContentAsync(client, request) as RestResponse;
        //     }).Wait();

        //     JArray jsonResponse = JsonConvert.DeserializeObject<JArray>(response.Content);
        //     var circleList = JsonConvert.DeserializeObject<List<Circle>>(jsonResponse.ToString());
        //     return circleList;
        // }

        // Display particular circle
        public static Circle GetThisCircle(int id)
        {
            var client   = new RestClient("http://localhost:5000/api/");
            var request  = new RestRequest("circles/" + id, Method.GET);
            var response = new RestResponse();

            Task.Run(async() =>
            {
                response = await GetAsyncResponse.GetResponseContentAsync(client, request) as RestResponse;
            }).Wait();

            JObject jsonResponse = JsonConvert.DeserializeObject <JObject>(response.Content);
            var     thisCircle   = JsonConvert.DeserializeObject <Circle>(jsonResponse.ToString());

            return(thisCircle);
        }
示例#12
0
        public static List <Circle> GetAllCircles()
        {
            var client   = new RestClient("http://localhost:5000/api/");
            var request  = new RestRequest("circles", Method.GET);
            var response = new RestResponse();

            Task.Run(async() =>
            {
                response = await GetAsyncResponse.GetResponseContentAsync(client, request) as RestResponse;
            }).Wait();

            JArray jsonResponse = JsonConvert.DeserializeObject <JArray>(response.Content);
            var    circleList   = JsonConvert.DeserializeObject <List <Circle> >(jsonResponse.ToString());

            return(circleList);
        }
示例#13
0
        public static List <Userprofile> GetAllUserprofilesNext()
        {
            var client   = new RestClient("http://localhost:5000/api/");
            var request  = new RestRequest("userprofiles/next/", Method.GET);
            var response = new RestResponse();

            Task.Run(async() =>
            {
                response = await GetAsyncResponse.GetResponseContentAsync(client, request) as RestResponse;
            }).Wait();

            Console.WriteLine(response);
            JArray jsonResponse    = JsonConvert.DeserializeObject <JArray>(response.Content);
            var    userprofileList = JsonConvert.DeserializeObject <List <Userprofile> >(jsonResponse.ToString());

            return(userprofileList);
        }