コード例 #1
0
        public IActionResult Edit(int Id)
        {
            UnitViewModel model = new UnitViewModel
            {
                Title = "Edit Unit",
                Unit  = _commonHelper.GetUnitById(Id)
            };

            return(View(model));
        }
コード例 #2
0
        public IActionResult Edit(int Id)
        {
            // Get selected question.
            var           question = _questionHelper.GetQuestionById(Id);
            var           unit     = _commonHelper.GetUnitById(question.UnitId);
            List <string> units    = _commonHelper.GetUnitNames();

            // Create page model.
            QuestionViewModel model = new QuestionViewModel
            {
                Content       = question.Content,
                Answer1       = question.Answer1,
                Answer2       = question.Answer2,
                Answer3       = question.Answer3,
                Answer4       = question.Answer4,
                CorrectAnswer = question.CorrectAnswer,
                Reference     = question.Reference,
                SelectedUnit  = unit.Name,
                Units         = units,
                Title         = "Edit Question"
            };

            return(View(model));
        }