示例#1
0
        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
            });
        }
示例#2
0
        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));
        }
示例#3
0
        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
            });
        }