async Task <bool> EnvironmentPutRequest(Environment environment) { var data = JsonConvert.SerializeObject(environment); var content = new StringContent(data, Encoding.UTF8, "application/json"); HttpResponseMessage response = await HttpClient.PutAsync($"{ApiBaseUrl}environments/{environment.Id}", content); return(response.IsSuccessStatusCode); }
async Task <Repost> EnvironmentPostRequest(Environment environment) { var data = JsonConvert.SerializeObject(environment.Name); var content = new StringContent(data, Encoding.UTF8, "application/json"); HttpResponseMessage response = await HttpClient.PostAsync($"{ApiBaseUrl}environments", content); var repostage = await response.Content.ReadAsStringAsync(); Repost repost = JsonConvert.DeserializeObject <Repost>(repostage); repost.Success = response.IsSuccessStatusCode; return(repost); }
public async Task <Environment> GetAsyncEnvironment(int?CompanyId, string EnvironmentName) { Environment environment = new Environment(); try { var func = new Func <Task <Environment> >(() => EnvironmentGetRequest(CompanyId, EnvironmentName)); environment = await _networkService.Retry(func, 3, OnRetry); } catch (Exception ex) { throw ex; } return(environment); }
public async Task <bool> PutAsync(Environment environment) { bool put = false; try { var func = new Func <Task <bool> >(() => EnvironmentPutRequest(environment)); put = await _networkService.Retry(func, 3, OnRetry); } catch (Exception ex) { throw ex; } return(put); }
public async Task <bool> DeleteAsync(Environment environment) { bool delete = false; try { var func = new Func <Task <bool> >(() => EnvironmentDeleteRequest(environment.Id)); delete = await _networkService.Retry(func, 3, OnRetry); } catch (Exception ex) { throw ex; } return(delete); }
public async Task <Repost> PostAsync(Environment environment) { Repost repost = new Repost(); try { var func = new Func <Task <Repost> >(() => EnvironmentPostRequest(environment)); repost = await _networkService.Retry(func, 3, OnRetry); } catch (Exception ex) { throw ex; } return(repost); }