public HttpResponseMessage GetCitiesByRegionId(int?regionId) { if (regionId == null || regionId <= 0) { return(Request.CreateResponse(HttpStatusCode.OK, new List <CityViewModel>())); } var cities = _placesService.GetCitiesByRegionId(regionId.Value).OrderBy(c => c.CityName); return(Request.CreateResponse(HttpStatusCode.OK, cities)); }
public JsonResult GetCitiesByRegionId(int regionId) { var regions = _placesService.GetCitiesByRegionId(regionId); return(Json(regions, JsonRequestBehavior.AllowGet)); }