Ejemplo n.º 1
0
        public ActionResult <Department> GetDepartmentById(int Id)
        {
            var departmentItem = _repository.GetDepartmentById(Id);


            if (departmentItem != null)
            {
                return(Ok(departmentItem));
            }
            return(NotFound());
        }
Ejemplo n.º 2
0
        public IList <EmployeeDepartment> GetEmployeeByDept(int id)
        {
            IList <EmployeeDepartment> employeeDepts = new List <EmployeeDepartment>();
            var dept = _IdepartmentRepo.GetDepartmentById(id);
            IList <Employee> employees = _IemployeeRepo.GetAllEmployees();

            foreach (var employee in employees)
            {
                if (employee.Dept_Id == dept.Dept_Id)
                {
                    EmployeeDepartment employeeDept = new EmployeeDepartment();
                    employeeDept.Dept_Id   = employee.Dept_Id;
                    employeeDept.Dept_Name = dept.Dept_Name;
                    employeeDept.Emp_Id    = employee.Emp_Id;
                    employeeDept.Name      = employee.Name;
                    employeeDepts.Add(employeeDept);
                }
            }
            return(employeeDepts);
        }