// GET: Department public ActionResult Index() { EmployeeContext employeeContext = new EmployeeContext(); List<Department> departments = employeeContext.Departments.ToList(); return View(departments); }
public ActionResult Details(int id) { EmployeeContext employeeContext = new EmployeeContext(); Employee employee= employeeContext.Employees.Single(emp => emp.Id == id); return View(employee); }
// // GET: /Employee/ public ActionResult Index() { EmployeeContext employeeContext = new EmployeeContext(); List<Employee> employees =employeeContext.Employees.ToList(); return View(employees); }
public ActionResult Details(int id) { EmployeeContext employeeContext = new EmployeeContext(); Employee employee= employeeContext.Employees.Single(emp => emp.EmployeeId == id);//We use Single() and take id to return employee information with a specific id //Employee employee = new Employee(); //employee.EmployeeId = 101; //employee.Name = "John"; //employee.Gender = "Male"; //employee.City = "London"; return View(employee); }