Example #1
0
        public IActionResult Get(int?Id)
        {
            if (Id != null)
            {
                ViewBag.PupilsInClass = Map(pupilService.GetAll().Where(x => x.GradePropId == Id));
                ViewBag.PupilFree     = Map(pupilService.GetAll().Where(x => x.GradePropId == null)).OrderBy(x => x.Age).ThenBy(x => x.Surname);
                GradeViewModel grade = Map(gradeService.GetById(Id.Value));
                ViewBag.TG       = Map(tgService.GetAll().Where(x => x.GradeId == Id));
                ViewBag.Teachers = Map(teacherService.GetAll(), Id.Value);
                ViewBag.TList    = Map(teacherService.GetAll());

                return(View("Details", grade));
            }

            return(NotFound());
        }
Example #2
0
        public IActionResult Get(int Id)
        {
            ViewBag.Teachers = Map(teacherService.GetAll().ToList());
            ViewBag.Teacher  = Map(teacherService.GetById(Id));
            List <TeacherGradeViewModel> TGList    = Map(tgService.GetAll().Where(x => x.TeacherId == Id).ToList());
            List <GradeViewModel>        GradeList = new List <GradeViewModel>();

            foreach (var item in TGList)
            {
                GradeViewModel grade = Map(gradeService.GetById(item.GradeId));
                grade.Pupils = Map(pupilService.GetAll().Where(x => x.GradePropId == item.GradeId).ToList());
                GradeList.Add(grade);
            }
            return(View("Index", GradeList));
        }