public ActionResult LocationIndoorDetail(string countryUrlPart, string locationNameUrlPart)
        {
            var location = geoSvc.GetLocationIndoor(country.ID, locationNameUrlPart);
            if (location == null) { return PlaceNotFound(); }

            ViewBag.Current = location;

            //var modPlace = geoSvc.GetObjectModMetaOrSystemCreate(location);
            //ViewBag.ModPlaceDetails = modPlace;

            ViewBag.Posts = new PostService().GetPostForLocation(location.ID, PostType.Unknown, ClientAppType.CfWeb);

            var intersectingAreas = geoSvc.GetIntersectingAreas(location);
            ViewBag.Provinces = intersectingAreas.Where(c => c.Type == CfType.Province).ToList();
            ViewBag.Cities = intersectingAreas.Where(c => c.Type == CfType.City).ToList();

            var closestLocations = geoSvc.GetClosestLocationsOfLocation(location.ID);
            ViewBag.ClosestLocations = closestLocations;

            var mapViewSettings = mappingSvc.GetBingViewByID(location.ID);
            if (mapViewSettings == default(PlaceBingMapView)) { mapViewSettings = PlaceBingMapView.GetDefaultIndoorSettings(location); }

            var mapModel = new Bing7MapWithLocationViewModel(location.NameUrlPart, 486, 240, location.Latitude,
                location.Longitude, location.AvatarRelativeUrl);
            mapModel.ViewOptions = new Bing7MapViewOptionsViewModel(mapViewSettings);
            ViewBag.MapView = mapModel;

            ViewBag.Climbs = geoSvc.GetCurrentClimbsOfLocation(location.ID).ToList();
            ViewBag.MediaList = medSvc.GetObjectsTopMedia(location.ID, 11);

            ViewBag.PageQR = string.Format("http://i/{0}", location.ID.ToString("N"));

            ViewBag.LatestOpinions = new ContentService().GetLatestOpinionsOnObject(location.ID, 20).ToList();

            return View();
        }
 public LocationOutdoorEditViewModel()
 {
     //-- This is required on postback to have the object to populate when model binding
     MapView = new Bing7MapWithLocationViewModel();
 }
 public LocationOutdoorEditViewModel()
 {
     //-- This is required on postback to have the object to populate when model binding
     MapView = new Bing7MapWithLocationViewModel();
 }
        public ActionResult LocationOutdoorDetail(string countryUrlPart, string locationTypeUrlPart, string locationNameUrlPart)
        {
            var location = geoSvc.GetLocationOutdoor(country.ID, locationNameUrlPart);
            if (location == null) { return PlaceNotFound(); }
            ViewBag.Current = location;

            //var modPlace = geoSvc.GetObjectModMetaOrSystemCreate(location);
            //ViewBag.ModPlaceDetails = modPlace;
            ViewBag.Posts = new PostService().GetPostForLocation(location.ID, PostType.Unknown, ClientAppType.CfWeb);

            SetPlaceContextToViewData(location);

            var mapViewSettings = mappingSvc.GetBingViewByID(location.ID);
            var mapModel = new Bing7MapWithLocationViewModel(location.NameUrlPart, 732, 340, location.Latitude,
                location.Longitude, location.AvatarRelativeUrl);
            mapModel.ViewOptions = new Bing7MapViewOptionsViewModel(mapViewSettings);
            ViewBag.MapView = mapModel;

            ViewBag.MediaList = medSvc.GetObjectsTopMedia(location.ID, 10);

            ViewBag.PageQR = string.Format("http://o/{0}", location.ID.ToString("N"));

            ViewBag.LatestOpinions = new ContentService().GetLatestOpinionsOnObject(location.ID, 20).ToList();

            return View();
        }
        private NewPartnerCallViewModel PrepareNewCallViewData(CfCacheIndexEntry place)
        {
            var m = new NewPartnerCallViewModel() { ParnterCallPlaceID = place.ID, ForIndoor = true, ForOutdoor = true };

            if (place.Type == CfType.Country)
            {
                ViewBag.PlaceDisallowed = true;
                ViewBag.Place = place;
            }
            else if (place.Type == CfType.Province)
            {
                var area = geoSvc.GetAreaByID(place.ID);

                ViewBag.PlaceDisallowed = true;
                ViewBag.Place = place;

                ViewBag.InterectingAreas = geoSvc.GetIntersectingAreas(area).Where(a => a.Type != CfType.Province
                    && !a.DisallowPartnerCalls).ToList();
            }
            else if (place.Type.ToPlaceCateogry() == PlaceCategory.Area)
            {
                ViewBag.PlaceType = "Area";
                var area = geoSvc.GetAreaByID(place.ID);
                ViewBag.Place = area;

                if (area.DisallowPartnerCalls) { ViewBag.PlaceDisallowed = true; }
                else
                {
                    var geoJsonUrl = Stgs.MapSvcRelativeUrl + "area/" + place.ID.ToString();

                    var mapModel = new Bing7GeoJsonMapViewModel("climbing-map-" + place.ID, 680, 400, geoJsonUrl);
                    mapModel.ViewOptions = new Bing7MapViewOptionsViewModel(mappingSvc.GetBingViewByID(area.ID));
                    var mapItems = new MappingService().GetAreaEditMapItems(area);
                    ViewBag.MapItemsArea = mapItems.Items[0];
                    mapItems.Items.RemoveAt(0);
                    ViewBag.MapItemsLocations = mapItems.Items;
                    ViewBag.MapModel = mapModel;
                }

                ViewBag.ChildLocations = geoSvc.GetGeoDeduciblePlaces(place).Where(p=>p.Type.IsLocation());

                ViewBag.InterectingAreas = geoSvc.GetIntersectingAreas(area).Where(a => a.Type != CfType.Province
                    && !a.DisallowPartnerCalls).ToList();
            }
            else if (place.Type.ToPlaceCateogry() == PlaceCategory.IndoorClimbing
                || place.Type.ToPlaceCateogry() == PlaceCategory.OutdoorClimbing)
            {
                ViewBag.PlaceType = "Location";
                var location = geoSvc.GetLocationByID(place.ID);
                ViewBag.Place = location;

                if (location.IsIndoorClimbing) { m.ForOutdoor = false; }
                if (location.IsOutdoorClimbing) { m.ForIndoor = false; }

                var mapModel = new Bing7MapWithLocationViewModel(location.NameUrlPart, 732, 340, location.Latitude,
                    location.Longitude, location.AvatarRelativeUrl);

                var mapViewSettings = mappingSvc.GetBingViewByID(location.ID);
                if (mapViewSettings == default(PlaceBingMapView)) { mapViewSettings = PlaceBingMapView.GetDefaultIndoorSettings(location); }
                mapModel.ViewOptions = new Bing7MapViewOptionsViewModel(mapViewSettings);
                ViewBag.LocationMapView = mapModel;

                ViewBag.InterectingAreas = geoSvc.GetIntersectingAreasOfPoint(location.Latitude, location.Longitude)
                    .Where(a => a.Type != CfType.Province && !a.DisallowPartnerCalls).ToList();
            }
            else
            {
                throw new ArgumentException("Place type [" + place.Type.ToString() + "] not supported for partner calls");
            }

            return m;
        }