public IActionResult TagsAll() { rootObject = GetAllTags(); if (_repository.getTagsData()) { bool areNewRecordsAdded = _repository.saveTags(rootObject); } return(View(rootObject)); }
public TagsRoot GetAllTags() { string CompaniesApi_End_Point = BASE_URL + "?API_KEY=qZEyjY0nTO9R8suzDCwQs06eVpyfFOkY7UVacerl"; string companyList = string.Empty; httpClient.BaseAddress = new Uri(CompaniesApi_End_Point); HttpResponseMessage response = httpClient.GetAsync(CompaniesApi_End_Point).GetAwaiter().GetResult(); if (response.IsSuccessStatusCode) { companyList = response.Content.ReadAsStringAsync().GetAwaiter().GetResult(); } if (!string.IsNullOrEmpty(companyList)) { rootObject = JsonConvert.DeserializeObject <TagsRoot>(companyList); } return(rootObject); }