Ejemplo n.º 1
0
        public async Task <IActionResult> CreateSubject()
        {
            var user = await _userManager.GetUserAsync(User);

            var isAdmin = await IsAdmin();

            var schoolIds         = _schoolsServices.GetAllByUserId <SchoolViewModel>(user?.UniqueGradebookId, isAdmin).Select(s => s.Id);
            var teachersInSchools = _teachersService.GetAllBySchoolIds <TeacherViewModel>(schoolIds);
            var inputModel        = new SubjectCreateInputModel
            {
                Teachers = teachersInSchools.Select(t => new SelectListItem($"{t.FirstName} {t.LastName} ({t.SchoolName})", t.Id.ToString())).ToList()
            };

            return(View(inputModel));
        }