public RegistrationViewModel(IRepository <Registration> repository, IViewRepository <RegistrationView> viewRepository, RoomsRepository rooomsRepository, IRepository <Guests> guestsRepository, IRepository <Discounts> discountsRepository, IRepository <GuestsDiscounts> guestsDiscountsRepository) : base(repository) { RoomsRepository = rooomsRepository; GuestsRepository = guestsRepository; ViewRepository = viewRepository; DiscountsRepository = discountsRepository; GuestsDiscountsRepository = guestsDiscountsRepository; repository.ModelCollectionChanged += () => { ViewRepository.Refresh(); RaisePropertyChanged("ViewCollection"); }; GuestsRepository.ModelCollectionChanged += () => { ViewRepository.Refresh(); RaisePropertyChanged("ViewCollection"); }; rooomsRepository.ModelCollectionChanged += () => { ViewRepository.Refresh(); RaisePropertyChanged("ViewCollection"); }; ViewRepository.ViewCollectionChanged += () => RaisePropertyChanged("ViewCollection"); }
public PaymentsViewModel(IRepository <Payment> repository, IViewRepository <PaymentsView> paymentsViewRepository, IRepository <Guests> guestsRepository, IRepository <Registration> registratinoRepository, IRepository <ServiceRealization> realizationRepository) : base(repository) { PaymentsViewRepository = paymentsViewRepository; PaymentsViewRepository.ViewCollectionChanged += () => RaisePropertyChanged("PaymentsViewCollection"); Repository.ModelCollectionChanged += () => RaisePropertyChanged("PaymentsViewCollection"); PaymentsViewRepository.Refresh(); IsAddAndEditButtonsEnabled = false; registratinoRepository.ModelCollectionChanged += () => { PaymentsViewRepository.Refresh(); RaisePropertyChanged("PaymentsViewCollection"); }; realizationRepository.ModelCollectionChanged += () => { PaymentsViewRepository.Refresh(); RaisePropertyChanged("PaymentsViewCollection"); }; GuestsRepositoryRef = guestsRepository; }