Beispiel #1
0
        public List <CountryTable> GetCountries()
        {
            DBFirstDemo         entity    = new DBFirstDemo();
            List <CountryTable> countries = entity.CountryTables.ToList();

            return(countries);
        }
Beispiel #2
0
        public ActionResult Index()
        {
            DBFirstDemo entity = new DBFirstDemo();

            ViewBag.Countries = new SelectList(GetCountries(), "country_id", "country_name");
            return(View());
        }
Beispiel #3
0
        public ActionResult GetStates(int cid)
        {
            DBFirstDemo       entity = new DBFirstDemo();
            List <StateTable> states = entity.StateTables.Where(x => x.country_id == cid).ToList();

            ViewBag.States = new SelectList(states, "state_id", "state_name");
            return(PartialView("DisplayStates"));
        }