Exemplo n.º 1
0
 public BuildingsViewModel()
 {
     _roomForRentDataAccess = RoomForRentViewModelConfig.GetDataAccess();
     AddressesViewModel     = new AddressesViewModel(_roomForRentDataAccess);
     ModelDeleter(i => _roomForRentDataAccess.DeleteBuilding(i));
     ModelsLoader(() => _roomForRentDataAccess.GetBuildings());
     ModelSaver(b => _roomForRentDataAccess.SaveBuilding(b));
 }
Exemplo n.º 2
0
 public ApartmentsViewModel()
 {
     _roomForRentDataAccess = RoomForRentViewModelConfig.GetDataAccess();
     ModelDeleter(a => { if (a.Id != null)
                         {
                             _roomForRentDataAccess.DeleteApartment(a.Id.Value);
                         }
                  });
     ModelsLoader(() => _roomForRentDataAccess.GetApartments());
     ModelSaver(a => _roomForRentDataAccess.SaveApartment(a));
     Collection(() => Buildings, () => _roomForRentDataAccess.GetBuildings(), () => SelectedBuilding,
                mdl => mdl.Building, a => a.BuildingId, b => b?.Id ?? 0);
     Collection(() => Owners, () => _roomForRentDataAccess.GetOwners(), () => SelectedOwner, a => a.Owner, a => a.OwnerId,
                o => o?.Id ?? 0);
 }