Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
        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);
        }
Esempio n. 5
0
        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);
        }
Esempio n. 6
0
        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);
        }