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);
        }
        private EditBingLocationViewModel BuildEditorViewModel(BingLocationPart part)
        {
            // Setting creation defaults - MapType is null on creation
            var mapType   = part.MapType ?? _mapListService.DefaultMapType;
            var isEnabled = (part.MapType != null) ? part.IsEnabled : true;

            var editModel = new EditBingLocationViewModel
            {
                LatitudeStr      = part.Latitude.toInvariantCultureString(),
                LongitudeStr     = part.Longitude.toInvariantCultureString(),
                Width            = part.Width,
                Height           = (part.Height == 0) ? 300 : part.Height,       // Default height
                Zoom             = part.Zoom,
                MapType          = mapType,
                BingMapLists     = _mapListService.GetBingMapLists(),
                MapTypeList      = _mapListService.CreateMapTypeList(mapType),
                PossibleMapIcons = GetPossibleMapIcons(),
                MapIcon          = part.MapIcon,
                MapIconFolder    = GetIconFolder(),
                IsEnabled        = isEnabled
            };

            if (part.BingMapList != null)
            {
                editModel.BingMapListId = part.BingMapList.Id;
            }

            return(editModel);
        }