コード例 #1
0
        public ActionResult LocationIndoorEdit(Guid id)
        {
            var location = geoSvc.GetLocationIndoorByID(id);

            if (location == null)
            {
                return(new PlacesController().PlaceNotFound());
            }

            var model = new LocationIndoorEditViewModel();

            model.InjectFrom(location);

            SetLocationIndoorEditViewData(location);

            var climbImageToDisplay = (location.HasAvatar) ? Stgs.ImgsRt + location.AvatarRelativeUrl : Stgs.DefaultMapInfoImage;

            var mapViewSettings = mappingSvc.GetBingViewByID(location.ID);

            if (mapViewSettings == default(PlaceBingMapView))
            {
                mapViewSettings = PlaceBingMapView.GetDefaultIndoorSettings(location);
            }
            model.LatLongEditorModel             = new Bing7MapWithLocationViewModel("myMap", 486, 240, location.Latitude, location.Longitude, climbImageToDisplay);
            model.LatLongEditorModel.ViewOptions = new Bing7MapViewOptionsViewModel(mapViewSettings);

            return(View(model));
        }
コード例 #2
0
        public ActionResult LocationIndoorEdit(Guid id)
        {
            var location = geoSvc.GetLocationIndoorByID(id);
            if (location == null) { return new PlacesController().PlaceNotFound(); }

            var model = new LocationIndoorEditViewModel();
            model.InjectFrom(location);

            SetLocationIndoorEditViewData(location);

            var climbImageToDisplay = (location.HasAvatar) ? Stgs.ImgsRt + location.AvatarRelativeUrl : Stgs.DefaultMapInfoImage;

            var mapViewSettings = mappingSvc.GetBingViewByID(location.ID);
            if (mapViewSettings == default(PlaceBingMapView)) { mapViewSettings = PlaceBingMapView.GetDefaultIndoorSettings(location); }
            model.LatLongEditorModel = new Bing7MapWithLocationViewModel("myMap", 486, 240, location.Latitude, location.Longitude, climbImageToDisplay);
            model.LatLongEditorModel.ViewOptions = new Bing7MapViewOptionsViewModel(mapViewSettings);

            return View(model);
        }
コード例 #3
0
        public ActionResult LocationIndoorEdit(Guid id, LocationIndoorEditViewModel m)
        {
            var location = geoSvc.GetLocationIndoorByID(id);
            var original = location.GetSimpleTypeClone();

            if (ModelState.IsValid)
            {
                location.InjectFrom(m);
                location.TypeID = (byte)m.Type;
                geoSvc.UpdateLocationIndoor(original, location);

                SaveBing7MapViewFromModel(m.LatLongEditorModel.ViewOptions, location.ID);

                return Redirect(location.SlugUrl);
            }
            else
            {
                SetLocationIndoorEditViewData(location);

                return View(m);
            }
        }
コード例 #4
0
        public ActionResult LocationIndoorEdit(Guid id, LocationIndoorEditViewModel m)
        {
            var location = geoSvc.GetLocationIndoorByID(id);
            var original = location.GetSimpleTypeClone();

            if (ModelState.IsValid)
            {
                location.InjectFrom(m);
                location.TypeID = (byte)m.Type;
                geoSvc.UpdateLocationIndoor(original, location);

                SaveBing7MapViewFromModel(m.LatLongEditorModel.ViewOptions, location.ID);

                return(Redirect(location.SlugUrl));
            }
            else
            {
                SetLocationIndoorEditViewData(location);

                return(View(m));
            }
        }