Beispiel #1
0
        public async Task <IActionResult> Index(int?id, int?courseID)
        {
            if (id != null)
            {
                var dataCourse = await _instructorService.GetCourseByInstructor(id.Value);

                ViewBag.Courses = dataCourse.Select(x => _mapper.Map <CoursesDTO>(x)).ToList();
                var instructor = await _instructorService.GetById(id.Value);

                var instr = _mapper.Map <InstructorDTO>(instructor);
                ViewBag.InstructorD = instr.LastName;
                ViewBag.Idins       = id.Value;
                if (courseID != null)
                {
                    var dataCourseE = await _courseService.GetStudentsByCourseEnrollment(courseID.Value);

                    //  ViewBag.CoursesE = dataCourseE.Select(x => _mapper.Map<Enrol>(x)).ToList();
                    ViewBag.CoursesE = dataCourseE;
                }
            }
            var data = await _instructorService.GetAll();

            var listInstructor = data.Select(x => _mapper.Map <InstructorDTO>(x)).ToList();

            return(View(listInstructor));
        }
        // GET: Instructors/Details/5
        public async Task <IActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var instructor = await instructorService.GetById(id.Value);

            var instructorDTO = mapper.Map <InstructorDTO>(instructor);

            return(View(instructorDTO));
        }
Beispiel #3
0
 public async Task <IEnumerable <InstructorModelData> > GetById(int id, int courseId)
 {
     return(await _service.GetById(id, courseId));
 }
Beispiel #4
0
 public InstructorViewModel GetById(Guid id)
 {
     return(Mapper.Map <InstructorViewModel>(instructorService.GetById(id)));
 }