public ListAppartmentViewModel(BusinessContext context)
 {
     Appartments             = new ObservableCollection <Appartment>();
     openAppartmentViewModel = new SelectedAppartmentViewModel(this, this.context);
     openOccupantViewModel   = new SelectedOccupantViewModel(this);
     this.context            = context;
 }
        //open dialog to create new occupant for given appartment
        private void OpenNewOccupant()
        {
            mode = Mode.Create;
            SelectedOccupantViewModel ocvm = new SelectedOccupantViewModel(this);

            ocvm.AppartmentId = selectedAppartment.AppartmentId;
            IModalDialog dialog = ServiceProvider.Instance.Get <IModalDialog>("occupantImplementation");

            dialog.BindViewModel(ocvm);
            dialog.ShowDialog();
        }
        //opens dialog to edit selected occupant
        private void OpenOccupantForEdit()
        {
            mode = Mode.Edit;
            SelectedOccupantViewModel ocvm = new SelectedOccupantViewModel(this)
            {
                AppartmentId = SelectedOccupant.AppartmentId, SelectedGender = SelectedOccupant.Gender,
                BirthDate    = SelectedOccupant.BirthDate, FirstName = SelectedOccupant.FirstName, LastName = SelectedOccupant.LastName,
                MiddleName   = SelectedOccupant.MiddleName, Owner = SelectedOccupant.Owner, Id = SelectedOccupant.OccupantId
            };
            IModalDialog dialog = ServiceProvider.Instance.Get <IModalDialog>("occupantImplementation");

            dialog.BindViewModel(ocvm);
            dialog.ShowDialog();
        }