コード例 #1
0
        public CountryViewModel All()
        {
            CountryViewModel countryViewModel = new CountryViewModel();

            countryViewModel.Countries = _countryRepo.Read();
            return(countryViewModel);
        }
コード例 #2
0
        public CountryViewModel All()
        {
            CountryViewModel cvm = new CountryViewModel();

            cvm.CountryList = _countryRepo.Read();
            return(cvm);
        }
コード例 #3
0
ファイル: CityService.cs プロジェクト: AbdilahiHassan/People
        public City Add(CreateCityViewModel createCity)
        {
            City city = new City();

            city.CityName           = createCity.cityName;
            city.CountryNationsName = _countryRepo.Read(createCity.NationsId);

            city = _cityRepo.Create(city);

            return(city);
        }
コード例 #4
0
        public City Add(CreateCityViewModel createCity)
        {
            //create city
            City city = new City();

            city.Name   = createCity.Name;
            city.Nation = _countryRepo.Read(createCity.NationId);
            city        = _cityRepo.Create(city);

            //update Country with city  --should not be needed
            //Country countryToUpdate = _countryRepo.Read(city.Nation.Id);
            //if (countryToUpdate != null)
            //{
            //    _countryRepo.Read(createCity.NationId).Cities.Add(city);
            //}
            return(city);
        }
コード例 #5
0
        public City Add(CreateCity createCity)
        {
            City city = new City();

            city.CityName = createCity.CityName;
            city.Country  = _countryRepo.Read(createCity.CountryId);

            return(_cityRepo.Create(city));
        }
コード例 #6
0
        public City Add(CreateCity createCity)              // CreateCity is the class, createCity is the ViewModel
        {
            City city = new City();                         // A "blank" city is created

            city.CityName = createCity.CityName;            // In this section add additional validations and checks
            // city.PersonInQuestion = _peopleRepo.Read(createCity.PersonInQuestionId);    // Using peopleRepo and the PersonInQuestionId to put in the right city based on the Id
            city.Country = _countryRepo.Read(createCity.CountryId);
            return(_cityRepo.Create(city));
        }
コード例 #7
0
 public List <Country> All()
 {
     return(_countryRepo.Read());
 }