public ActionResult AddEmployeeToDepartment(ED.AddEmployeeToDepartmentForm form) { if (ModelState.IsValid) { DepartmentService.AddEmployeeDepartment(form.SelectedEmployeeId, form.SelectedDepartmentId, SessionUser.GetUser().Id); } return(RedirectToAction("Index", "Employee")); }
public ActionResult AddEmployeeToDepartment(int id) { List <SelectListItem> DepartmentList = new List <SelectListItem>(); foreach (C.Department dep in DepartmentService.GetAllActive()) { DepartmentList.Add(new SelectListItem { Text = dep.Title, Value = dep.Id.ToString() }); } ED.AddEmployeeToDepartmentForm form = new ED.AddEmployeeToDepartmentForm { SelectedEmployeeId = id, DepartmentList = DepartmentList }; return(View(form)); }