public ActionResult AddEmployees(EmployeeModel emp)
        {
            DepartmentRepository departmentRepository = new DepartmentRepository();
            var department = departmentRepository.GetDepartments();

            ViewBag.Data1 = department;

            DesignationRepository designationRepository = new DesignationRepository();
            var Designation = designationRepository.GetDesignations();

            ViewBag.Data = Designation;


            EmployeeRepository EmployeeRepositoryObject = new EmployeeRepository();

            //AddEmployee AddEmployeeObject = new AddEmployee();
            if (EmployeeRepositoryObject.AddEmployeeData(emp))
            {
                ViewBag.Msg = "Employee Details are successfully Added";
            }
            else
            {
                ViewBag.Msg = "Employee Details are Not successfully Added";
            }
            return(View(emp));
        }
        public IActionResult DeleteEmployee(int ID)
        {
            EmployeeRepository   EmployeeRepositoryObject = new EmployeeRepository();
            DepartmentRepository departmentRepository     = new DepartmentRepository();
            var department = departmentRepository.GetDepartments();

            ViewBag.Data1 = department;

            DesignationRepository designationRepository = new DesignationRepository();
            var Designation = designationRepository.GetDesignations();

            ViewBag.Data = Designation;

            return(View(EmployeeRepositoryObject.GetEmployees().Find(asd => asd.ID == ID)));
        }
        public IActionResult GetEmployees()
        {
            EmployeeRepository EmployeeRepositoryObject = new EmployeeRepository();

            ModelState.Clear();
            DepartmentRepository departmentRepository = new DepartmentRepository();
            var department = departmentRepository.GetDepartments();

            ViewBag.Data1 = department;

            DesignationRepository designationRepository = new DesignationRepository();
            var Designation = designationRepository.GetDesignations();

            ViewBag.Data = Designation;

            return(View(EmployeeRepositoryObject.GetEmployees()));
        }
        public IActionResult AddEmployees()
        {
            DepartmentRepository departmentRepository = new DepartmentRepository();
            var department = departmentRepository.GetDepartments();

            ViewBag.Data1 = department;

            DesignationRepository designationRepository = new DesignationRepository();
            var Designation = designationRepository.GetDesignations();

            ViewBag.Data = Designation;

            //DesignationRepository designationRepository = new DesignationRepository();
            //ViewBag["Designation"] = designationRepository.GetDesignations();
            //DesignationRepository designationRepository = new DesignationRepository();
            //ViewBag["Designation"] = designationRepository.GetDesignations();

            return(View());
        }
        public IActionResult UpdateEmployee(int ID, EmployeeModel s1)
        {
            DepartmentRepository departmentRepository = new DepartmentRepository();
            var department = departmentRepository.GetDepartments();

            ViewBag.Data1 = department;

            DesignationRepository designationRepository = new DesignationRepository();
            var Designation = designationRepository.GetDesignations();

            ViewBag.Data = Designation;

            EmployeeRepository EmployeeRepositoryObject = new EmployeeRepository();

            if (EmployeeRepositoryObject.UpdateEmployeeData(s1))
            {
                return(RedirectToAction("GetEmployees"));
            }
            else
            {
                return(View());
            }
        }
示例#6
0
 public List <DesignationModel> GetDesignations()
 {
     return(designationRepository.GetDesignations());
 }