public string GetZipDistance(ProfileViewModel profile, double zip1, double zip2) { var user = authProvider.GetCurrentUser(); zip1 = user.ZipCode; string zipA = user.ZipCode.ToString(); var gamerProfile = profileSearchDAL.GetProfile(profile.ProfileId); zip2 = gamerProfile.ZipCode; string zipB = user.ZipCode.ToString(); WebClient webClient = new WebClient(); string host = "https://www.zipcodeapi.com/rest/4Gfn1Q4ds8zgjzvAO9vCIk3R1ovzdHOZw3wOOazm04Tb21YjVK3tB1iVRcbrRCyK/distance.json/" + zipA + "/" + zipB + "/mile"; var webResult = webClient.DownloadString(host); int index = webResult.IndexOf(":") + 1; return(webResult.Substring(index, webResult.Length - 1 - index)); }
public IActionResult GamerProfile(int id) { var profile = profileSearchDAL.GetProfile(id); profile = profileDAL.GetProfile(profile.Username); AllInformationModel AllInfo = new AllInformationModel(); var user = authProvider.GetCurrentUser(); var currentUser = profileDAL.GetProfile(user.Username); profile.IsPopulated = false; if (currentUser.GameTitles.Count != 0 && currentUser.GenreNames.Count != 0) { AllInfo.AllUsers = profileSearchDAL.GetMatches(); AllInfo.CurrentUser = AllInfo.GetCurrentGamer(AllInfo.AllUsers, user.Username); profile.MatchStrength = AllInfo.Matches(AllInfo.AllUsers, AllInfo.CurrentUser); profile.IsPopulated = true; } return(View(profile)); }