예제 #1
0
        public async Task PutOppotunity(int id, Oppotunity oppotunity)
        {
            var httpClient = new HttpClient();
            var json       = JsonConvert.SerializeObject(oppotunity);

            StringContent content = new StringContent(json);

            content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
            var result = await httpClient.PutAsync(Url + id, content);
        }
예제 #2
0
        public async Task <bool> PostOppotunity(Oppotunity oppotunity)
        {
            var httpClient = new HttpClient();
            var json       = JsonConvert.SerializeObject(oppotunity);

            StringContent content = new StringContent(json);

            content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
            var result = await httpClient.PostAsync(Url + "/Oppotunities", content);

            if (result.IsSuccessStatusCode)
            {
                return(true);
            }

            return(false);
        }
예제 #3
0
        public async Task <bool> PostSaveOppotunity(Oppotunity oppotunity, string AccessToken)
        {
            var httpClient = new HttpClient();

            httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue
                                                                 ("Bearer", AccessToken);
            var json = JsonConvert.SerializeObject(oppotunity);

            HttpContent content = new StringContent(json);

            content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
            var result = await httpClient.PostAsync(Url + "/SavedOppotunities", content);

            if (result.IsSuccessStatusCode)
            {
                return(true);
            }

            return(false);
        }