示例#1
0
        public ActionResult CountryDetail(string countryUrlPart)
        {
            ViewBag.Current   = country;
            ViewBag.Provinces = AppLookups.CountrysProvinces(country.ID);
            var areas = geoSvc.GetCitiesAndMajorClimbingAreasOfCountry(country.ID);

            ViewBag.Cities = areas.Where(a => a.Type == CfType.City).ToList().RandomSample(12);
            var climbingAreas = areas.Where(a => a.Type == CfType.ClimbingArea).ToList();

            ViewBag.ClimbingAreas = climbingAreas.RemoveAllChildAreas().RandomSample(12);

            var geoJsonUrl = Stgs.MapSvcRelativeUrl + "country/" + countryUrlPart;
            var mapModel   = new Bing7GeoJsonMapViewModel("climbing-map-" + countryUrlPart, 730, 460, geoJsonUrl)
            {
                MapTypeId = "road"
            };

            mapModel.ViewOptions = new Bing7MapViewOptionsViewModel(mappingSvc.GetCustomCountryBingMapView(country));
            ViewBag.MapModel     = mapModel;

            ViewBag.TopClimbs    = geoSvc.GetTopClimbOfCountry(country.ID, 24);
            ViewBag.TopLocations = geoSvc.GetTopLocationsOfCountry(country.ID);

            return(View("CountryDetail"));
        }
示例#2
0
        public ActionResult ProvinceDetail(Area area, IEnumerable <Location> locationsOfArea)
        {
            var provinces = AppLookups.CountrysProvinces(area.CountryID);

            provinces.Remove(area);
            ViewBag.Provinces = provinces;

            var intersectingAreas = geoSvc.GetIntersectingAreasWithGeoInflate(area);

            ViewBag.Cities = intersectingAreas.Where(p => p.Type == CfType.City).ToList();

            var intersectingParentClimbingAreas = intersectingAreas.Where(p => p.Type == CfType.ClimbingArea && p.ShapeArea > area.ShapeArea).ToList();
            var intersectingChildClimbingAreas  = intersectingAreas.Where(p => p.Type == CfType.ClimbingArea && p.ShapeArea < area.ShapeArea).ToList().RemoveAllChildAreas().Take(20).ToList();

            var displayClimbingAreas = new List <Area>(intersectingParentClimbingAreas);

            displayClimbingAreas.AddRange(intersectingChildClimbingAreas);

            ViewBag.ClimbingAreas = displayClimbingAreas.OrderByDescending(l => l.Rating).ToList();

            var geoJsonUrl = Stgs.MapSvcRelativeUrl + "province/" + area.ID.ToString();

            ViewBag.MapModel = new Bing7GeoJsonMapViewModel("rock-climbing-map-" + area.NameUrlPart, 730, 420, geoJsonUrl)
            {
                ViewOptions = ViewBag.MapView
            };

            return(View("ProvinceDetail"));
        }