コード例 #1
0
        public void OnGet()
        {
            var majors      = _majorAppService.GetAllSelection();
            var schoolYears = _schoolYearAppService.GetAllSelection();
            var allMajors   = majors.Select(x => new SelectListItem()
            {
                Text  = x.Name,
                Value = x.Id.ToString()
            }).ToList();

            var allSchoolYears = schoolYears.Select(x => new SelectListItem()
            {
                Text  = x.Name,
                Value = x.Id.ToString()
            }).ToList();

            ViewData.Add("allMajors", SerializeObject(allMajors));
            ViewData.Add("allSchoolYears", SerializeObject(allSchoolYears));
        }
コード例 #2
0
        public async Task OnGetAsync()
        {
            var majors      = _majorAppService.GetAllSelection();
            var schoolYears = _schoolYearAppService.GetAllSelection().OrderByDescending(x => x.Id);

            Majors = majors.Select(x => new SelectListItem()
            {
                Text  = x.Name,
                Value = x.Id.ToString()
            }).ToList();

            SchoolYears = schoolYears.Select(x => new SelectListItem()
            {
                Text  = x.Name,
                Value = x.Id.ToString()
            }).ToList();

            var curriculumDto = await _curriculumAppService.GetAsync(Id);

            Curriculum = ObjectMapper.Map <CurriculumDto, CurriculumFormModel>(curriculumDto);
        }