Example #1
0
        // GET: Department
        public ActionResult Index()
        {
            EmployeeContext employeeContext = new EmployeeContext();
            List<Department> departments = employeeContext.Departments.ToList();

            return View(departments);
        }
Example #2
0
        public ActionResult Details(int id)
        {
            EmployeeContext employeeContext = new EmployeeContext();
            Employee employee= employeeContext.Employees.Single(emp => emp.Id == id);

            return View(employee);
        }
Example #3
0
 //
 // GET: /Employee/
 public ActionResult Index()
 {
     EmployeeContext employeeContext = new EmployeeContext();
     List<Employee> employees =employeeContext.Employees.ToList();
     
     return View(employees);
 }
Example #4
0
        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);
        }