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); }
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); }
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); }