Example #1
0
        public async void GetPlatformActualAndSaveorUpdate(Bearer bearer)
        {
            List <Platform> platformList = new List <Platform>();

            string PlatformWellActualURL = ConfigurationManager.AppSetting["PlatformWellActualAPI:URL"];

            using (var httpClient = new HttpClient())
            {
                httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", bearer.token);

                using (var response = await httpClient.GetAsync(PlatformWellActualURL))
                {
                    string apiResponse = await response.Content.ReadAsStringAsync();

                    try
                    {
                        platformList = JsonConvert.DeserializeObject <List <Platform> >(apiResponse);
                        DALUtility.InsertOrUpdatePlatformWellData(platformList);
                    }
                    catch (Exception ex)
                    {
                    }
                }
            }
        }