public ActionResult BrowseOrgData(int? departmentId, int? employeeId) { eManagerContext db = new eManagerContext(); var viewModel = new BrowseOrgDataViewModel(); viewModel.Departments = db.Departments.ToList(); //.Include(e => e.Employees.Select(d => d.Department)); if (departmentId != null) { viewModel.Employees = viewModel.Departments.Where( d => d.Id == departmentId).Single().Employees; } if (employeeId != null) { var selectedEmployee = viewModel.Employees.Where( e => e.Id == employeeId).Single(); db.Entry(selectedEmployee).Collection(x => x.Dependents).Load(); viewModel.Dependents = selectedEmployee.Dependents; } return View(viewModel); }
public ActionResult GetEmployees(int DepartmentID) { eManagerContext db = new eManagerContext(); db.Configuration.ProxyCreationEnabled = false; var employees = db.Employees.Where( d => d.DepartmentID == DepartmentID).ToList(); return Json(employees, JsonRequestBehavior.AllowGet); }
public DependentRepository(eManagerContext context) { this.context = context; }
public GenericRepository(eManagerContext context) { this.context = context; }
public EmployeeRepository(eManagerContext context) { this.context = context; }