public ActionResult <IList <Department> > GetAllDepartments() { if (_classroomService == null) { return(NotFound()); } return(_classroomService.GetAllDepartments().ToList()); }
public IEnumerable <Department> GetAllDepartments() { var departments = _repository.GetAllDepartments(); foreach (Department department in departments) { yield return(department); } }