コード例 #1
0
 public ActionResult AddEmployeeToDepartment(ED.AddEmployeeToDepartmentForm form)
 {
     if (ModelState.IsValid)
     {
         DepartmentService.AddEmployeeDepartment(form.SelectedEmployeeId, form.SelectedDepartmentId, SessionUser.GetUser().Id);
     }
     return(RedirectToAction("Index", "Employee"));
 }
コード例 #2
0
        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));
        }