public JsonResult Index()
        {
            var timetablesViewModels = _timeTableRepository.GetAll().Select(Mapper.Map <TimeTableViewModel>).ToList();

            foreach (var timeTable in timetablesViewModels)
            {
                timeTable.ClassName   = _classesRepository.GetClassNameAndDivisionBy(timeTable.ClassId);
                timeTable.SubjectName = _subjectRepository.GetSubjectNameWithCode(timeTable.SubjectId);
                timeTable.FacultyName = _facultyRepository.GetFacultyFullNameBy(timeTable.FacultyId);
            }
            return(Json(new { result = timetablesViewModels }, JsonRequestBehavior.AllowGet));
        }
Esempio n. 2
0
        public IEnumerable <TimeTableViewModel> BuildTimeTableViewModel(IEnumerable <TimeTable> schedule)
        {
            var scheduleViewModel = schedule.Select(Mapper.Map <TimeTableViewModel>).ToList();

            foreach (var timeTable in scheduleViewModel)
            {
                timeTable.ClassName   = _classesRepository.GetClassNameAndDivisionBy(timeTable.ClassId);
                timeTable.SubjectName = _subjectRepository.GetSubjectNameWithCode(timeTable.SubjectId);
                timeTable.FacultyName = _facultyRepository.GetFacultyFullNameBy(timeTable.FacultyId);
            }
            return(scheduleViewModel);
        }