Exemplo n.º 1
0
 public LocationListViewModel(MainWindow view)
 {
     _locationRepository = view.LocationRepository;
     _filmRepository     = view.FilmRepository;
     Locations           = new ObservableCollection <Location>(_locationRepository.List());
     CurrentLocation     = _locationRepository.List().FirstOrDefault();
 }
Exemplo n.º 2
0
 public CountryListViewModel(MainWindow view)
 {
     _countryRepository     = view.CountryRepository;
     _filmCountryRepository = view.FilmCountryRepository;
     _filmRepository        = view.FilmRepository;
     Countries      = new ObservableCollection <Country>(_countryRepository.List());
     CurrentCountry = _countryRepository.List().FirstOrDefault();
 }
Exemplo n.º 3
0
 public CountryListView(MainWindow view)
 {
     InitializeComponent();
     Model = view.CountryModel;
     _countryRepository     = view.CountryRepository;
     _filmCountryRepository = view.FilmCountryRepository;
     _filmRepository        = view.FilmRepository;
     DataContext            = Model;
 }
Exemplo n.º 4
0
 public FilmListViewModel(MainWindow view)
 {
     _mainView              = view;
     _countryRepository     = view.CountryRepository;
     _filmCountryRepository = view.FilmCountryRepository;
     _filmPersonRepository  = view.FilmPersonRepository;
     _filmRepository        = view.FilmRepository;
     _locationRepository    = view.LocationRepository;
     _personRepository      = view.PersonRepository;
     Films       = new ObservableCollection <Film>(_filmRepository.List());
     CurrentFilm = _filmRepository.List().FirstOrDefault();
 }
Exemplo n.º 5
0
        internal void StoredFilms()
        {
            List <string>          titles = new List <string>();
            AbstractFilmRepository fRepo  = _filmRepository;

            foreach (Film f in fRepo.List())
            {
                if (f.Location.Id.Equals(CurrentLocation.Id))
                {
                    titles.Add(f.Title);
                }
            }

            if (titles.Count > 0)
            {
                StringChooser chooser = new StringChooser(titles);
                chooser.ShowDialog();
            }
            else
            {
                ReportIt("There are no films stored in this location");
            }
        }
Exemplo n.º 6
0
        internal void ShowContributions(Role role)
        {
            AbstractFilmPersonRepository fpRepo = _filmPersonRepository;
            AbstractFilmRepository       fRepo  = _filmRepository;
            List <Guid>   ids    = fpRepo.ListFilmIdsForPersonIdAndRole(CurrentPerson.Id, role);
            List <string> titles = new List <string>();

            foreach (Guid id in ids)
            {
                Film f = fRepo.GetById(id);
                titles.Add(f.Title);
            }
            if (titles.Count > 0)
            {
                StringChooser chooser = new StringChooser(titles);
                chooser.ShowDialog();
            }
            else
            {
                string[] actions = { " contributes to", " acts in", " composes for", " directs" };
                string   action  = actions[(int)role];
                ReportIt("As yet " + CurrentPerson.FullName + action + " no film");
            }
        }