public ActionResult Details(int id) { EmployeeContext employeeContext = new EmployeeContext(); Employee employee = employeeContext.Employees.Single(x => x.EmployeeId == id); return View(employee); }
// // GET: /Department/ public ActionResult Index() { EmployeeContext employeeContext = new EmployeeContext(); List<Department> departments = employeeContext.Departments.ToList(); return View(departments); }
public ActionResult Index(int departmentId) { EmployeeContext employeeContext = new EmployeeContext(); List<Employee> employees = employeeContext.Employees.Where(emp => emp.DepartmentId == departmentId).ToList(); return View(employees); }