public async Task <IActionResult> Index(GetTeacherInput input)
        {
            var models = await _teacherService.GetPagedTeacherList(input);

            var dto = new TeacherListViewModel();

            if (input.Id != null)
            {
                //查询老师教授的课程列表
                var teacher = models.Data.FirstOrDefault(a => a.Id == input.Id.Value);
                if (teacher != null)
                {
                    dto.Courses = teacher.CourseAssignments.Select(a => a.Course).ToList();
                }
                dto.SelectedId = input.Id.Value;
            }

            if (input.CourseId.HasValue)
            {
                //查询该课程下有多少学生报名
                var course = dto.Courses.FirstOrDefault(a => a.CourseID == input.CourseId.Value);
                if (course != null)
                {
                    dto.StudentCourses = course.StudentCourses.ToList();
                }
                dto.SelectedCourseId = input.CourseId.Value;
            }
            dto.Teachers = models;

            return(View(dto));
        }
Exemplo n.º 2
0
        public ActionResult List()
        {
            var teacherList   = new TeacherListViewModel();
            var teachersListb = _userService.GetAllTeachers();

            teacherList.Teachers = teachersListb.Select(x => x.Map()).ToList();
            return(View(teacherList));
        }
Exemplo n.º 3
0
        public ActionResult Index()
        {
            List <Teacher> teachers = repository.GetAll();

            TeacherListViewModel model = new TeacherListViewModel();

            model.Teachers = teachers;

            return(View(model));
        }
Exemplo n.º 4
0
        public ActionResult Index()
        {
            var viewModel = new TeacherListViewModel();
            viewModel.TeacherViewModels =
                this._teacherManager
                    .GetAll(this.HttpContext.Cache.GetInstitutionID())
                    .Select(TeacherMapper.ToViewModelExpression.Compile())
                    .ToList();

            return View(viewModel);
        }
Exemplo n.º 5
0
        // 선생님 전체 조회
        public TeacherListViewModel GetAllTeachers()
        {
            var teachers = context.Teachers.ToList();

            var teacherViewModel = new TeacherListViewModel()
            {
                Teachers = teachers
            };

            return(teacherViewModel);
        }
        // GET: Teacher
        public async Task <IActionResult> Index(int?id)
        {
            var teacher = await _context.Teacher.Where(m => m.Id == id).FirstOrDefaultAsync();

            var courses   = _context.Course.Where(m => m.FirstTeacherId == id);
            var viewmodel = new TeacherListViewModel
            {
                Courses = await courses.ToListAsync(),
                Teacher = teacher
            };

            return(View(viewmodel));
        }
        public async Task <IActionResult> List()
        {
            var studentListViewModel = new TeacherListViewModel {
                Teachers = new List <TeacherMvcDto>()
            };


            var teacherFilterViewModel = new TeacherFilterViewModel
            {
                Genders = await _optionManager.GetGenders()
            };


            ViewBag.TeacherFilterViewModel = teacherFilterViewModel;

            return(View(studentListViewModel));
        }
        public async Task <IActionResult> List([FromForm] TeacherFilterViewModel teacherFilterViewModel)
        {
            var teacherListViewModel = new TeacherListViewModel();

            var teacherListResult = await _teacherManager.GetList(_mapper.Map <TeacherFilterModel>(teacherFilterViewModel));

            if (teacherListResult.IsOk)
            {
                var teachers = _mapper.Map(teacherListResult.Data.Teachers, new List <TeacherMvcDto>());
                teacherListViewModel.Teachers = teachers;
            }

            var timeTextResult = await _teacherManager.GetCachedData();

            teacherFilterViewModel.Genders = await _optionManager.GetGenders();

            teacherListViewModel.TimeText      = timeTextResult.Data;
            teacherListViewModel.ReturnMessage = Resource.OperationCompletedSuccessfully;

            ViewBag.TeacherFilterViewModel = teacherFilterViewModel;

            return(View(teacherListViewModel));
        }