public AuthorController(IAuthorLookupDataService authorLookupDataService,
                         IRepository <Author> authorsRepository,
                         INationalityLookupDataService nationalityLookupDataService)
 {
     this.authorLookupDataService      = authorLookupDataService ?? throw new ArgumentNullException(nameof(authorLookupDataService));
     this.authorsRepository            = authorsRepository ?? throw new ArgumentNullException(nameof(authorsRepository));
     this.nationalityLookupDataService = nationalityLookupDataService ?? throw new ArgumentNullException(nameof(nationalityLookupDataService));
 }
        public AuthorDetailViewModel(IEventAggregator eventAggregator,
                                     IMetroDialogService metroDialogService,
                                     IRepository <Author> authorRepo,
                                     INationalityLookupDataService nationalityLookupDataService)
            : base(eventAggregator, metroDialogService)
        {
            Repository = authorRepo ?? throw new ArgumentNullException(nameof(authorRepo));
            this.nationalityLookupDataService = nationalityLookupDataService
                                                ?? throw new ArgumentNullException(nameof(nationalityLookupDataService));

            AddAuthorPictureCommand            = new DelegateCommand(OnAddAuthorPictureExecute);
            NationalitySelectionChangedCommand = new DelegateCommand(OnNationalitySelectionChangedExecute);

            SelectedItem  = new Author();
            Nationalities = new ObservableCollection <LookupItem>();
        }
        public MainPageViewModel(IEventAggregator eventAggregator, ILanguageLookupDataService languageLookup,
                                 INationalityLookupDataService nationalityLookupDataService,
                                 IFormatLookupDataService formatLookupDataService,
                                 IGenreLookupDataService genreLookupDataService)
        {
            this.eventAggregator = eventAggregator ?? throw new ArgumentNullException(nameof(eventAggregator));
            this.languageLookup  = languageLookup ?? throw new ArgumentNullException(nameof(languageLookup));
            this.nationalityLookupDataService = nationalityLookupDataService ?? throw new ArgumentNullException(nameof(nationalityLookupDataService));
            this.formatLookupDataService      = formatLookupDataService ?? throw new ArgumentNullException(nameof(formatLookupDataService));
            this.genreLookupDataService       = genreLookupDataService ?? throw new ArgumentNullException(nameof(genreLookupDataService));

            AddNewItemCommand        = new DelegateCommand <Type>(OnAddNewItemExecute);
            EditLanguagesCommand     = new DelegateCommand(OnEditLanguagesExecute);
            EditNationalitiesCommand = new DelegateCommand(OnEditNationalitiesExecute);
            EditBookFormatsCommand   = new DelegateCommand(OnEditBookFormatsExecute);
            EditBookGenresCommand    = new DelegateCommand(OnEditBookGenresExecute);
        }
        public NationalityDetailViewModel(IEventAggregator eventAggregator,
                                          IMetroDialogService metroDialogService,
                                          IRepository <Nationality> nationalityRepository,
                                          INationalityLookupDataService nationalityLookupService)
            : base(eventAggregator, metroDialogService)
        {
            Repository = nationalityRepository;
            this.nationalityLookupService = nationalityLookupService ?? throw new ArgumentNullException(nameof(nationalityLookupService));

            ChangeEditedNationCommand = new DelegateCommand <Guid?>(OnChangeEditedNationExecute);

            SelectedItem = new Nationality();

            UserMode = (!UserMode.Item1, DetailViewState.EditMode, Brushes.LightGray, !UserMode.Item4).ToTuple();

            Nations = new ObservableCollection <LookupItem>();
        }
        public NationalityDetailViewModel(IEventAggregator eventAggregator,
                                          ILogger logger,
                                          ISimpleDomainService <Nationality, NationalityId> domainService,
                                          INationalityLookupDataService nationalityLookupDataService,
                                          IDialogService dialogService)
            : base(eventAggregator, logger, domainService, dialogService)
        {
            _nationalityLookupDataService = nationalityLookupDataService ?? throw new ArgumentNullException(nameof(nationalityLookupDataService));

            ChangeEditedNationalityCommand = new DelegateCommand <Guid?>(OnChangeEditedNationalityExecute);
            SaveItemCommand = new DelegateCommand(SaveItemExecute, base.SaveItemCanExecute)
                              .ObservesProperty(() => SelectedItem.Name);

            SelectedItem = CreateWrapper(domainService.CreateItem());

            Nations = new ObservableCollection <LookupItem>();

            UserMode = (!UserMode.Item1, DetailViewState.EditMode, Brushes.LightGray, !UserMode.Item4).ToTuple();
        }
        public MainPageViewModel([NotNull] IEventAggregator eventAggregator,
                                 [NotNull] INationalityLookupDataService nationalityLookupDataService,
                                 [NotNull] IFormatLookupDataService formatLookupDataService,
                                 [NotNull] IGenreLookupDataService genreLookupDataService,
                                 [NotNull] ILanguageLookupDataService languageLookupDataService)
        {
            _eventAggregator = eventAggregator ?? throw new ArgumentNullException(nameof(eventAggregator));
            _nationalityLookupDataService = nationalityLookupDataService
                                            ?? throw new ArgumentNullException(nameof(nationalityLookupDataService));
            _formatLookupDataService   = formatLookupDataService ?? throw new ArgumentNullException(nameof(formatLookupDataService));
            _genreLookupDataService    = genreLookupDataService ?? throw new ArgumentNullException(nameof(genreLookupDataService));
            _languageLookupDataService = languageLookupDataService ?? throw new ArgumentNullException(nameof(languageLookupDataService));

            ShowItemsCommand = new DelegateCommand <Type>(OnShowItemsExecute);

            AddNewItemCommand        = new DelegateCommand <Type>(OnAddNewItemExecute);
            EditLanguagesCommand     = new DelegateCommand(OnEditLanguagesExecute);
            EditNationalitiesCommand = new DelegateCommand(OnEditNationalitiesExecute);
            EditBookFormatsCommand   = new DelegateCommand(OnEditBookFormatsExecute);
            EditBookGenresCommand    = new DelegateCommand(OnEditBookGenresExecute);
        }
Exemplo n.º 7
0
 public AuthorService(IRepository <Author> repository, INationalityLookupDataService nationalityLookupDataService)
 {
     Repository = repository ?? throw new ArgumentNullException(nameof(repository));
     NationalityLookupDataService = nationalityLookupDataService ?? throw new ArgumentNullException(nameof(nationalityLookupDataService));
 }
 public AuthorService(IRepository <Author, AuthorId> repository,
                      INationalityLookupDataService nationalityLookupDataService = null)
 {
     NationalityLookupDataService = nationalityLookupDataService;
     Repository = repository ?? throw new ArgumentNullException(nameof(repository));
 }