Ejemplo n.º 1
0
        public IActionResult AddEmployee(EmployeeAllEmployeeViewModel vm)
        {
            var department =
                allDepartment.SingleOrDefault(m => m.DepartmentId == vm.Department.DepartmentId);

            vm.Employee.Department = department;
            allEmployee.Add(vm.Employee);
            return(RedirectToAction("AllEmployee"));
        }
Ejemplo n.º 2
0
        public IActionResult AddEmployee()
        {
            var departmentDisplay = allDepartment.Select
                                        (x => new { Id = x.DepartmentId, Value = x.DepartmentName });
            EmployeeAllEmployeeViewModel vm = new EmployeeAllEmployeeViewModel();

            vm.DepartmentList = new SelectList(departmentDisplay, "Id", "Value");
            return(View(vm));
        }