public TeleportLocationScoresModel GetTeleportLocationScoresModel(string urbanAreaScoresLink) { TeleportLocationScoresModel teleportLocationScoresModel = new TeleportLocationScoresModel(); try { JObject jObject = GetJObject(urbanAreaScoresLink); String summary = jObject["summary"].Value <string>().Replace("<p>", "").Replace("</p>", "").Replace("<i>", "").Replace("</i>", "") .Replace("</b>", "").Replace("\n", "").Replace("<b>", "").Replace(" ", "").Replace(".", " . ").Replace("<br>", "").Replace("</br>", ""); teleportLocationScoresModel.Summary = summary; teleportLocationScoresModel.CityScore = jObject["teleport_city_score"].Value <int>(); LinkedList <TeleportLocationScoreModel> teleportSearchedCityDistrictScores = new LinkedList <TeleportLocationScoreModel>(); foreach (JObject category in jObject["categories"] as JArray) { TeleportLocationScoreModel teleportSearchedCityDistrictScore = new TeleportLocationScoreModel(); teleportSearchedCityDistrictScore.Color = category["color"].Value <String>(); teleportSearchedCityDistrictScore.ScoreName = category["name"].Value <String>(); teleportSearchedCityDistrictScore.ScoreOutOfTen = category["score_out_of_10"].Value <int>(); teleportSearchedCityDistrictScores.AddLast(teleportSearchedCityDistrictScore); } teleportLocationScoresModel.TeleportSearchedCityDistrictScores = teleportSearchedCityDistrictScores; } catch (Exception) { return(null); } return(teleportLocationScoresModel); }
public ActionResult <TeleportLocationScoresModel> findLocationScores([FromBody] UrbanAreaScoresLinkDTO urbanAreaScoresLink) { //System.Diagnostics.Debug.WriteLine("urbanAreaScoresLink : "+urbanAreaScoresLink.UrbanAreaScoresLink); TeleportLocationScoresModel teleportSearchedCityDistrictScoresInfo = TeleportLocationService.GetTeleportLocationScoresModel(urbanAreaScoresLink.UrbanAreaScoresLink); if (teleportSearchedCityDistrictScoresInfo == null) { return(NotFound()); } return(teleportSearchedCityDistrictScoresInfo); }