Actually i am trying to get the employees information based on the deptno.
My Tables:
1.tblemployee2-->colomns-->Id,name,email,sal,deptid
2.tbldept2-->colomns-->deptid,deptname.
here 2 tables has the relation with foreign key constraint.
now i want to retrieve employee names whose deptid is matching with deptid of tbldept2 table.I am getting error in controller
public class employeeController : Controller
{
//
// GET: /employee/
public ActionResult Index(int id)
{
employeecontext empcontext = new employeecontext();
employee emplist = empcontext.employees.Where(emp => emp.DEPTID == id);
return View(emplist);
}
public ActionResult Details()
{
employeecontext employeecontext = new employeecontext();
List empnames= employeecontext.employees.ToList();
return View(empnames);
}
}

Ravi KumarRank #2,085 · 690 reputationPosted Nov 9, 2015, 11:33 PM EST
Ravi PatelRank #439 · 5.7K reputationPosted Nov 9, 2015, 11:55 PM EST
Ram Pradeep54 reputationPosted Nov 10, 2015, 12:31 AM EST
Ram Pradeep54 reputationPosted Nov 10, 2015, 12:31 AM EST
Ravi PatelRank #439 · 5.7K reputationPosted Nov 10, 2015, 12:37 AM EST