public BuildingEditViewModel(BuildingViewModel model, IEnumerable <AddressViewModel> addresses, Action removeBuildingAction) : base(model.Model, addresses) { DisplayName = TranslationProvider.Translate("EditBuilding"); BuildingViewModel = model; m_RemoveBuilding = removeBuildingAction; SelectedAddress = addresses.FirstOrDefault(avm => avm.Model == model.Model.Address); //SelectedAddress = addresses.FirstOrDefault(avm => avm.Model.Buildings.FirstOrDefault(b => b == model.Model) != null); }
public RoomViewModel(BuildingRoom room, BindableCollection <BuildingViewModel> buildings) { m_Model = room; m_Buildings = buildings; m_SelectedBuilding = buildings.FirstOrDefault(i => i.Rooms.Contains(room)); }