public void AddCountry() { string abbrev = GetAString("A country abbreviation"); CountryRepository countryRepo = _factory.CreateCountryRepository(); Country c = countryRepo.GetByAbreviation(abbrev); FilmCountry fc = new FilmCountry(); fc.FilmId = CurrentFilm.Id; fc.CountryId = c.Id; FilmCountryRepository filmCountryRepo = _factory.CreateFilmCountryRepository(); filmCountryRepo.Add(fc); }
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(); } }