public ActionResult <AffordableHouse[]> Get(int zipCode) { using (var webClient = new WebClient()) { String houseJSON = webClient.DownloadString("https://data.cityofchicago.org/resource/s6ha-ppgi.json"); houses = AffordableHouse.FromJson(houseJSON); housesFiltered = houses.Where(x => x.ZipCode == zipCode).ToArray(); return(housesFiltered); } }
public void OnPost() { using (var webClient = new WebClient()) { String schoolJSON = webClient.DownloadString("https://data.cityofchicago.org/resource/tj8h-mnuv.json"); schools = ElementarySchool.FromJson(schoolJSON); String houseJSON = webClient.DownloadString("https://data.cityofchicago.org/resource/s6ha-ppgi.json"); houses = AffordableHouse.FromJson(houseJSON); housesFiltered = houses.Where(x => x.ZipCode == ZipSearch).ToArray(); schoolsFiltered = schools.Where(x => x.ZipCode == ZipSearch).ToArray(); ViewData["AffordableHouses"] = housesFiltered; ViewData["ElementarySchools"] = schoolsFiltered; } searchFinished = true; }