public JsonResult FindCitiesByCountry(int countryId) { List <City> citylist = new List <City>(); SCountry sco = new SCountry(); citylist = sco.FindCitiesByCountry(countryId); return(new JsonResult { Data = citylist, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); }
public ActionResult Get(int id) { List <City> citylist = new List <City>(); SCountry sco = new SCountry(); citylist = sco.FindCitiesByCountry(id); List <Models.City> citiesm = new List <Models.City>(); citiesm = citylist.Select(e => new Models.City().InjectFrom(e)).Cast <Models.City>().ToList(); //return new JsonResult { Data = citylist, JsonRequestBehavior = JsonRequestBehavior.AllowGet }; //return citiesm; return(this.Json(citiesm, JsonRequestBehavior.AllowGet)); }
public JsonResult Get(string name) { List <City> citylist = new List <City>(); SCountry sco = new SCountry(); System.Char delimiter = '-'; var ciudad = sco.FindCityByName(name.Split(delimiter)[1]); citylist = sco.FindCitiesByCountry(int.Parse(name.Split(delimiter)[0])).Where(e => e.Id != ciudad.Id).ToList(); citylist.Insert(0, ciudad); return(new JsonResult { Data = citylist, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); }