public ActionResult Edit(int id) { TerminalModel tm = new TerminalModel(); var terminal_list = db.Database.SqlQuery <Terminal>("Select * from Terminal where Id=" + id).SingleOrDefault(); tm.term = terminal_list; SelectListItem item = new SelectListItem(); item.Value = ""; item.Text = "--Select--"; SelectList complist = new SelectList(_companyRepository.FindAll().Where(x => !x.IsDeleted && x.Active).OrderBy(s => s.Name), "Id", "Name", tm.term.CompanyId); tm.companies = CardController.AddFirstItem(complist, item); SelectListItem item1 = new SelectListItem(); item1.Value = ""; item1.Text = "--Select--"; SelectList tabuildinglist = new SelectList(_BuildingObjectRepository.FindAll(x => (x.TypeId == 8 || x.TypeId == 1) && !x.IsDeleted), "Id", "Description", tm.term.TARegisterBoId); tm.TABuildingList = CardController.AddFirstItem(tabuildinglist, item1); return(PartialView("Edit", tm)); }