public ActionResult CreateEmployee(EmployeeModel employeeModel)
        {
            ViewBag.Departments  = new SelectList(departmentBL.GetDepartment(), "DepartmentId", "DepartmentName");
            ViewBag.Managers     = new SelectList(employeeBL.GetManager(), "ManagerId", "ManagerName");
            ViewBag.Designations = new SelectList(employeeBL.GetDesignation(), "DesignationId", "DesignationName");
            if (ModelState.IsValid)
            {
                var employee = AutoMapper.Mapper.Map <EmployeeModel, Employee>(employeeModel);
                employeeBL.AddEmployee(employee);
                Account(employeeModel);
                //Employee employee = new Employee();
                //employee.EmployeeName = employeeModel.EmployeeName;
                //employee.EmployeeAge = employeeModel.EmployeeAge;
                //employee.EmployeePhoneNumber = employeeModel.EmployeePhoneNumber;
                //employee.EmployeeEmail = employeeModel.EmployeeEmail;
                //employee.DepartmentId = employeeModel.DepartmentId;
                //employee.DesignationId = employeeModel.DesignationId;
                //employee.ManagerId = employeeModel.ManagerId;


                return(RedirectToAction("DisplayEmployee"));
            }
            return(View());
        }
Ejemplo n.º 2
0
            public Employee AddEmployee(Employee employee)
            {
                var result = employeeBL.AddEmployee(employee);

                return(result);
            }