Exemple #1
0
        public async Task <IActionResult> AddSubject()
        {
            var subjectCategories = await _subjectCategoryService.GetAllSubjectCategoryAsync();

            var categoryDescriptions = subjectCategories
                                       .Select(x => new SelectListItem
            {
                Text  = x.Description,
                Value = x.Id.ToString()
            }).ToList();

            var subjectBindingModel = new SubjectBindingModel
            {
                SubjectCategoryDescription = categoryDescriptions
            };

            return(View(subjectBindingModel));
        }
Exemple #2
0
        public async Task <IActionResult> Index()
        {
            var currentUser = await _userManager.GetUserAsync(User);

            if (currentUser == null)
            {
                return(Challenge());
            }

            var subjectCategories = await _subjectCategoryService.GetAllSubjectCategoryAsync();

            var viewModel = new SubjectCategoryViewModel
            {
                SubjectCategoryModels = subjectCategories
            };

            return(View(viewModel));
        }