Пример #1
0
        public ActionResult LocationOutdoorEdit(Guid id)
        {
            var location = new GeoService().GetLocationOutdoorByID(id);

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

            var climbImageToDisplay = (location.AvatarRelativeUrl != string.Empty)
                ? Stgs.ImgsRt + location.AvatarRelativeUrl
                : Stgs.DefaultMapInfoImage;

            ViewBag.ClimbingImageToDisplayUrl = climbImageToDisplay;

            var model = new LocationOutdoorEditViewModel();

            model.InjectFrom(location);

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

            model.MapView             = new Bing7MapWithLocationViewModel("myMap", 650, 340, location.Latitude, location.Longitude, climbImageToDisplay);
            model.MapView.ViewOptions = new Bing7MapViewOptionsViewModel(mapView);

            return(View(model));
        }
Пример #2
0
        public ActionResult LocationOutdoorEdit(Guid id, LocationOutdoorEditViewModel m)
        {
            var location = geoSvc.GetLocationOutdoorByID(id);
            var original = location.GetSimpleTypeClone();

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

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

                return(Redirect(location.SlugUrl));
            }
            else
            {
                return(View(m));
            }
        }