Ejemplo n.º 1
0
        /// <summary>
        /// </summary>
        /// <param name="customerApplicationId"></param>
        /// <returns></returns>
        public VblApplicationDto GetVblApplication(int customerApplicationId)
        {
            var url = $"{AllocationApiBaseUrl}/VBL/applications/GetApplication?applicationId={customerApplicationId}";

            using (var httpClient = _httpClient.CreateHttpClient())
            {
                var response = httpClient.GetAsync(url).Result;

                if (!response.IsSuccessStatusCode)
                {
                    LogApiMessage(url);

                    return(null);
                }

                var jsonString = response.Content.ReadAsStringAsync().Result;
                var customerApplicationDetail = JsonConvert.DeserializeObject <VblApplicationDto>(jsonString);

                return(customerApplicationDetail);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// </summary>
        /// <param name="id"></param>
        /// <param name="contact"></param>
        /// <returns></returns>
        /// <exception cref="Exception"></exception>
        public bool SaveSupportDisabilities(int id, VBLContact contact)
        {
            var saveSupportDetailsUrl = _allocationApiUrl + "/VBL/contacts/PutContact?id=" + id + "&contact=" + contact;

            bool success;

            using (var httpClient = _httpClient.CreateHttpClient())
            {
                var result = httpClient.PutAsJsonAsync(saveSupportDetailsUrl, contact).Result;

                if (result.StatusCode == HttpStatusCode.OK)
                {
                    bool.TryParse(result.Content.ReadAsStringAsync().Result, out success);
                }
                else
                {
                    throw new Exception(HttpStatusCode.InternalServerError.ToString());
                }
            }

            return(success);
        }