Esempio n. 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);
        }
Esempio n. 2
0
 public void Update(Dependent updateEntity)
 {
     context.Entry(updateEntity).State = EntityState.Modified;
 }
Esempio n. 3
0
 public void Update(Employee updateEntity)
 {
     context.Entry(updateEntity).State = EntityState.Modified;
 }