public ActionResult <TeleportLocationCountryModel> findLocationCountryInfo([FromBody] CountryLinkDTO countryLinkDTO) { TeleportLocationCountryModel teleportCountryInfo = TeleportLocationService.GetTeleportLocationCountryModel(countryLinkDTO.CountryLink); if (teleportCountryInfo == null) { return(NotFound()); } return(new JsonResult(teleportCountryInfo)); }
public TeleportLocationCountryModel GetTeleportLocationCountryModel(string countryLink) { TeleportLocationCountryModel teleportCountryInfoModel = new TeleportLocationCountryModel(); try { JObject jObjectCountry = GetJObject(countryLink); teleportCountryInfoModel.Name = jObjectCountry["name"].Value <string>(); teleportCountryInfoModel.CurrencyCode = jObjectCountry["currency_code"].Value <string>(); teleportCountryInfoModel.Iso_alpha2 = jObjectCountry["iso_alpha2"].Value <string>(); teleportCountryInfoModel.Iso_alpha3 = jObjectCountry["iso_alpha3"].Value <string>(); teleportCountryInfoModel.Population = jObjectCountry["population"].Value <int>(); teleportCountryInfoModel.TeleportCountrySalaries = GetTeleportLocationCountrySalaryModels(((jObjectCountry["_links"])["country:salaries"])["href"].Value <string>()); } catch (Exception) { return(null); } return(teleportCountryInfoModel); }