Exemple #1
0
        // GET: OfficeAssignments/Create
        public async Task <ActionResult> Create()
        {
            var instructors = await instructorService.GetAll();

            ViewBag.Instructors = instructors.Select(x => mapper.Map <InstructorDTO>(x)).ToList();
            return(View());
        }
Exemple #2
0
        // GET: OfficeAssignments/Create
        public async Task <IActionResult> Create()
        {
            var listinstructors = await _instructorService.GetAll();

            ViewBag.Instructors = listinstructors;
            return(View());
        }
Exemple #3
0
 // GET: Instructor
 public IActionResult Index()
 {
     if (TempData["_mensagem"] != null)
     {
         TempData["_mensagem"] = JsonConvert.DeserializeObject <VMMessages>(TempData["_mensagem"].ToString());
     }
     return(View(_instructorService.GetAll()));
 }
        public ActionResult <IEnumerable <Instructor> > GetInstructorsForTrainingCourse(int trainingCourseId)
        {
            var entites     = instructorService.GetAll(i => i.TrainingCourseId == trainingCourseId);
            var instructors = mapper.Map <IEnumerable <InstructorDTO> >(entites);

            return(Ok(instructors));
        }
        // GET: Instructors
        public async Task <IActionResult> Index(int?id, int?courseID)
        {
            //return View(await _context.Instructor.ToListAsync());



            if (id != null)
            {
                var data = await instructorService.GetCursosByInstructor(id.Value);

                ViewBag.Courses = data.Select(x => mapper.Map <CourseDTO>(x)).ToList();
            }

            if (courseID != null)
            {
                //var enrollments = await enrollmentService.GetAll();
                var data = await instructorService.GetEnrollmentsByCurso(courseID.Value);

                ViewBag.Enrollments = data.Select(x => mapper.Map <EnrollmentDTO>(x)).ToList();
            }
            var data1 = await instructorService.GetAll();

            //return View(await _studentService.GetAll());
            var listInstructors = data1.Select(x => mapper.Map <InstructorDTO>(x)).ToList();

            return(View(listInstructors));
        }
Exemple #6
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));
        }
Exemple #7
0
        public IHttpActionResult GetAll()
        {
            List <InstructorDto> instructors;

            using (_instructorService)
            {
                instructors = _instructorService.GetAll();
            }
            return(Ok(instructors));
        }
Exemple #8
0
        public void GetAll_UnderNormalConditions_ReturnsMultipleInstructors()
        {
            //Arrange
            Mock.Arrange(() => _instructorService.GetAll()).Returns(_mockInstructorList).OccursOnce();

            var expected = _mockInstructorList;

            var instructorController = new InstructorController(_instructorService);

            ////Act
            var actual        = instructorController.GetAll() as OkNegotiatedContentResult <List <InstructorDto> >;
            var actualContent = actual.Content;

            //Assert
            Mock.Assert(_instructorService);
            Assert.That(actualContent, Is.EqualTo(expected));
        }
Exemple #9
0
        // GET: Instructors
        public async Task <IActionResult> Index(int?id, int?courseID)
        {
            if (id != null)
            {
                var data = await _instructorService.GetCoursesByInstructor(id.Value);

                ViewBag.Courses = data.Select(x => _mapper.Map <CourseDTO>(x)).ToList();
            }
            if (courseID != null)
            {
                var dataCourse = await _instructorService.GetStudentsByCourse(courseID.Value);

                ViewBag.Students = dataCourse.Select(x => _mapper.Map <EnrollmentDTO>(x)).ToList();
            }

            var dataList = await _instructorService.GetAll();

            var listInstructors = dataList.Select(x => _mapper.Map <InstructorDTO>(x)).ToList();

            return(View(listInstructors));
        }
Exemple #10
0
        // GET: Departments/Create
        public async Task <ActionResult> Create()
        {
            ViewBag.Instructors = await instructorService.GetAll();

            return(View());
        }
 public ActionResult Index()
 {
     return(View(
                _instructorService.GetAll(CurrentUserHelper.Get.UserId)
                ));
 }
Exemple #12
0
 public IEnumerable <InstructorViewModel> GetAll()
 {
     return(Mapper.Map <IEnumerable <InstructorViewModel> >(instructorService.GetAll()));
 }