// GET: Department public ActionResult Index() { EmployeeContext emp = new EmployeeContext(); List <Department> dep = emp.Departments.ToList(); return(View(dep)); }
// GET: Employee //public ActionResult Index(int? departmentId) //{ // var employee = new List<Employee>(); // var emp1 = new List<Employee>(); // EmployeeContext emp = new EmployeeContext(); // if (departmentId == 0 || departmentId == null) // { // employee = emp.Employees.ToList(); // return View(employee); // } // emp1 = emp.Employees.Where(e => e.DepartmentId == departmentId).ToList(); // return View(emp1); //} public ActionResult Details(int id) { EmployeeContext emp = new EmployeeContext(); Employee employee = emp.Employees.Single(x => x.EmployeeId == id); return(View(employee)); }