Example #1
0
 public void ConvertTo(CityCommunityView cityCommunityView, CityCommunity cityCommunity)
 {
     cityCommunity.CityCommunityPK = cityCommunityView.CityCommunityPK;
     cityCommunity.Name            = cityCommunityView.Name;
     cityCommunity.Code            = cityCommunityView.Code;
     cityCommunity.CountyFK        = cityCommunityView.CountyFK;
 }
Example #2
0
        public void ConvertFrom(CityCommunity cityCommunity, CityCommunityView cityCommunityView, ObjectContext db)
        {
            cityCommunityView.CityCommunityPK = cityCommunity.CityCommunityPK;
            cityCommunityView.Name            = cityCommunity.Name;
            cityCommunityView.Code            = cityCommunity.Code;
            cityCommunityView.CountyFK        = cityCommunity.CountyFK;

            //get country id
            ICountiesRepository countiesRepository = new CountiesRepository(db);

            cityCommunityView.CountryFK = countiesRepository.GetCountyByPK((int)cityCommunityView.CountyFK).CountryFK;
        }
Example #3
0
        public void BindDDLs(CityCommunityView cityCommunityView, ObjectContext db)
        {
            //countries ddl
            ICountriesRepository countriesRepository = new CountriesRepository(db);

            cityCommunityView.Countries = new SelectList(countriesRepository.GetValid().OrderBy("Name ASC").ToList(), "CountryPK", "Name");

            //counties ddl
            if (cityCommunityView.CountryFK != null)
            {
                ICountiesRepository countiesRepository = new CountiesRepository(db);
                cityCommunityView.Counties = new SelectList(countiesRepository.GetCountiesByCountry(Convert.ToInt32((int)cityCommunityView.CountryFK)).OrderBy("Name ASC"), "CountyPK", "Name");
            }
            else
            {
                cityCommunityView.Counties = new SelectList(new List <County>(), "CountyPK", "Name");
            }
        }