Example #1
0
        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);
        }
Example #2
0
        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);
        }
Example #3
0
 public DependentRepository(eManagerContext context)
 {
     this.context = context;
 }
Example #4
0
 public DependentRepository(eManagerContext context)
 {
     this.context = context;
 }
Example #5
0
 public GenericRepository(eManagerContext context)
 {
     this.context = context;
 }
Example #6
0
 public EmployeeRepository(eManagerContext context)
 {
     this.context = context;
 }
Example #7
0
 public EmployeeRepository(eManagerContext context)
 {
     this.context = context;
 }