public List <tblCountry> GetCountries() { dbfirstdemoEntities entity = new dbfirstdemoEntities(); List <tblCountry> countries = entity.tblCountries.ToList(); return(countries); }
// GET: Home public ActionResult Index() { dbfirstdemoEntities entity = new dbfirstdemoEntities(); ViewBag.Countries = new SelectList(GetCountries(), "ID", "Name"); return(View()); }
public ActionResult GetStates(int cid) { dbfirstdemoEntities entity = new dbfirstdemoEntities(); List <tblstates2> states = entity.tblstates2.Where(x => x.coun_id1 == cid).ToList(); ViewBag.States = new SelectList(states, "coun_id1", "states1"); return(PartialView("GetStates")); }
// GET: join public ActionResult Index() { dbfirstdemoEntities db = new dbfirstdemoEntities(); Employeedeparment emp = new Employeedeparment(); emp.employeedeparments = (from d in db.departments join e in db.Employees on d.ID equals e.ID select new Employeedeparment() { EmployeeFName = e.FirstName, EmployeelName = e.lastName, DepartmentName = d.Name, DepartmentLocation = d.location, }).ToList(); return(View(emp)); }