Ejemplo n.º 1
0
 public CountryListViewModel(IRepositoryFactory factory)
 {
     _factory           = factory;
     _countryRepository = factory.CreateCountryRepository();
     Countries          = new ObservableCollection <Country>(_countryRepository.List());
     CurrentCountry     = _countryRepository.List().FirstOrDefault();
 }
Ejemplo n.º 2
0
        internal void ShowCountries()
        {
            FilmCountryRepository fcRepo = _factory.CreateFilmCountryRepository();
            CountryRepository     cRepo  = _factory.CreateCountryRepository();
            List <Guid>           ids    = fcRepo.ListCountryIdsForFilmId(CurrentFilm.Id) as List <Guid>;
            List <string>         names  = new List <string>();

            foreach (Guid g in ids)
            {
                Country c = cRepo.GetById(g);
                names.Add(c.Name);
            }
            if (names.Count == 0)
            {
                FilmMessageBox box = new FilmMessageBox("There are as yet no countries defined for this film.");
                box.Show();
            }
            else
            {
                StringChooser chooser = new StringChooser(names);
                chooser.Show();
            }
        }
Ejemplo n.º 3
0
        private void PopulteRepositories()
        {
            FilmRepository filmRepo = _factory.CreateFilmRepository();

            filmRepo.AddRange(SeedCollection._baseFilmList);
            PersonRepository personRepo = _factory.CreatePersonRepository();

            personRepo.AddRange(SeedCollection._basePersonList);
            CountryRepository countryRepo = _factory.CreateCountryRepository();

            countryRepo.AddRange(SeedCollection._baseCountryList);
            LocationRepository locationRepo = _factory.CreateLocationRepository();

            locationRepo.AddRange(SeedCollection._baseLocationist);
        }