Exemple #1
0
        public async Task OnGetAsync()
        {
            var curriculums = _curriculumAppService.GetAllSelection();

            Curriculums = curriculums.Select(x => new SelectListItem()
            {
                Text  = $"{x.Name} - {x.SchoolYear.Course}",
                Value = x.Id.ToString()
            }).ToList();

            var subjectGroups = _subjectGroupAppService.GetAllSelection();

            Parents = subjectGroups.Select(x => new SelectListItem()
            {
                Text  = x.Name,
                Value = x.Id.ToString()
            }).ToList();
            Parents.AddFirst(new SelectListItem()
            {
                Text = "--"
            });

            var subjectGroupDto = await _subjectGroupAppService.GetAsync(Id);

            SubjectGroup = ObjectMapper.Map <SubjectGroupDto, SubjectGroupFormModel>(subjectGroupDto);
        }
        public void OnGet()
        {
            var curriculums    = _curriculumAppService.GetAllSelection();
            var allCurriculums = curriculums.Select(x => new SelectListItem()
            {
                Text  = $"{x.Name} - {x.SchoolYear.Course}",
                Value = x.Id.ToString()
            }).ToList();

            var subjectGroups = _subjectGroupAppService
                                .GetAllSelection()
                                .Where(x => x.Childrens.Count > 0)
                                .ToList();
            var allSubjectGroups = subjectGroups.Select(x => new SelectListItem()
            {
                Text  = x.Name,
                Value = x.Id.ToString()
            }).ToList();

            ViewData.Add("allCurriculums", SerializeObject(allCurriculums));
            ViewData.Add("allSubjectGroups", SerializeObject(allSubjectGroups));
        }