コード例 #1
0
        public IActionResult Update(EditLearnOutcomeViewModel vm)
        {
            // Validate the model
            if (!ModelState.IsValid)
            {
                // Get the view model and return it
                return(View("Update", vm));
            }

            //Add the question and answer to the learning outcome
            vm.LearningOutcome.QuestionAnswer.Add(context.ReadQuesAnswer(vm.QuestionId));
            context.UpdateOutcome(vm.LearningOutcome.Id, vm.LearningOutcome);
            return(RedirectToAction("Index"));
        }
コード例 #2
0
        /// <summary>
        /// IAction method for returning an update of a learningOutcome
        /// </summary>
        /// <param name="id">Id for a learningOutcome</param>
        /// <returns></returns>
        public IActionResult Update(int id)
        {
            // Get the list of Questions and Answers
            var listQA = context.ReadAllQuesAnswers().ToList();

            ViewBag.QAs = listQA;

            var model = context.ReadOutcome(id);

            var vm = new EditLearnOutcomeViewModel()
            {
                LearningOutcome = model,
                //QuestionId = model.QuestionAnswer.Id
            };

            return(View(vm));
        }