private async Task OnSaveClicked() { var locationModel = new LocationModel { DmMapUrl = DmMapUrl, Name = Name, PlayerMapUrl = PlayerMapUrl, RelatedLocation = Locations.Select(vm => ObjectId.Parse(vm.Id)).ToList() }; await _gameScreenContext.AddLocations(new[] { locationModel }); _closeCallback(); }
public LocationViewmodel(LocationModel location, INodeService nodeService, INodeNavigationService nodeNavigationService, INavigationContext navigationContext, LocationListItemViewmodel.Factory locationListItemViewmodelFactory, IWindowService windowService, NewLocationViewmodel.Factory newLocationViewmodelFactory) : this() { _location = location; _nodeService = nodeService; _nodeNavigationService = nodeNavigationService; _navigationContext = navigationContext; _locationListItemViewmodelFactory = locationListItemViewmodelFactory; _windowService = windowService; _newLocationViewmodelFactory = newLocationViewmodelFactory; _name = location.Name; _id = location.Id.ToString(); LoadedCommand = new ActionCommand(OnLoaded); Locations = new PageableObservableCollection <LocationListItemViewmodel>(); AddLocationCommand = new ActionCommand(OnNewLocationClick); }