Пример #1
0
        public async Task <IActionResult> Details(string Id)
        {
            int decryptedId;
            int y;

            if (int.TryParse(Id, out y))
            {
                decryptedId = y;
            }
            else
            {
                decryptedId = Convert.ToInt32(protector.Unprotect(Id));
            }
            var level = await levelService.GetLevel(decryptedId);

            if (level == null)
            {
                return(View("NotFound", decryptedId));
            }
            if (decryptedId < 1)
            {
                return(RedirectToAction("Index"));
            }
            LevelDetailsViewModel levelDetailsViewModel = new LevelDetailsViewModel
            {
                Level       = level,
                EncryptedId = Id,
                PageTitle   = "DEPARTMENT DETAILS"
            };

            return(View(levelDetailsViewModel));
        }
Пример #2
0
        public string GetLevelCode(int id)
        {
            var level = _levelService.GetLevel(new Services.Requests.Level.GetLevelRequest {
                Id = id
            }).Code;

            return(level);
        }
Пример #3
0
        public ActionResult Update(int id)
        {
            var response = _levelService.GetLevel(new GetLevelRequest {
                Id = id
            });
            var viewModel = response.MapTo <UpdateLevelViewModel>();

            return(View(viewModel));
        }
Пример #4
0
        public ActionResult <LevelAPI> GetLevel(int id)
        {
            // var specificLevel = _levels.SingleOrDefault(level => level.id == id);
            var specificLevel = _levelService.GetLevel(id);

            if (specificLevel == null)
            {
                return(NoContent());
            }
            return(Ok(specificLevel));
        }
Пример #5
0
        public ActionResult GetQuestionDetail(int id)
        {
            QuestionViewModel qvm = questionService.GetQuestionById(id);

            List <LevelViewModel> levels = levelService.GetLevel();

            List <LearningOutcomeViewModel> learningOutcomes = learningOutcomeService.GetLearningOutcomeByCourseId(qvm.CourseId);

            List <CategoryViewModel> categories = categoryService.GetCategoriesByCourseId(qvm.CourseId);

            QuestionDetailViewModel qdvm = new QuestionDetailViewModel()
            {
                Question         = qvm,
                Levels           = levels,
                LearningOutcomes = learningOutcomes,
                Categories       = categories
            };

            TempData["active"] = "Course";
            return(View("EditQuestion", qdvm));
        }