private EditBingMapListViewModel BuildEditorViewModel(BingMapListPart part) { var mapType = part.MapType ?? _mapListService.DefaultMapType; if (part.BingLocations == null) { part.BingLocations = new List <BingLocationPart>(); } var editModel = new EditBingMapListViewModel { CenterLatitudeStr = part.CenterLatitude.toInvariantCultureString(), CenterLongitudeStr = part.CenterLongitude.toInvariantCultureString(), Width = part.Width, Height = (part.Height == 0) ? 300 : part.Height, // Default height Zoom = part.Zoom, MapType = mapType, MapTypeList = _mapListService.CreateMapTypeList(mapType), BingLocations = part.BingLocations, Titles = GetTitles(part), MapIconFolder = GetIconFolder() }; return(editModel); }
//POST protected override DriverResult Editor(BingMapListPart part, IUpdateModel updater, dynamic shapeHelper) { updater.TryUpdateModel(part, Prefix, null, null); // Get Center Lat, long from model (required to work in cultures that use , in decimal numbers) var model = new EditBingMapListViewModel(); updater.TryUpdateModel(model, Prefix, new [] { "CenterLatitudeStr", "CenterLongitudeStr" }, null); part.CenterLatitude = model.CenterLatitude; part.CenterLongitude = model.CenterLongitude; return(Editor(part, shapeHelper)); }