/// <summary> /// IAction method for returning a deletion view /// </summary> /// <param name="id">Id for a learningOutcome</param> /// <returns></returns> public IActionResult Delete(int id) { LearnOutcome Lout = context.ReadOutcome(id); if (Lout == null) { return(RedirectToAction("Index")); } return(View(Lout)); }
/// <summary> /// IAction method for adding a learning outcome to a course /// </summary> /// <param name="courseId">Id for a concentration</param> /// <param name="learnOutcomeId">Id for a learning outcome</param> /// <returns></returns> public IActionResult AddLearningOutcome(int learningOutcomeId, int courseId) { try { if (!ModelState.IsValid || learningOutcomeId == 0) { return(RedirectToAction("Details", new { id = courseId })); } var lo = context.ReadOutcome(learningOutcomeId); var course = context.ReadCourse(courseId); context.AddLOToACourse(lo, course); } catch (Exception ex) { return(Content(ex.ToString())); } return(RedirectToAction("Details", new { id = courseId })); }
public IActionResult Add(AddQuesAnswerViewModel vm) { //Reinitialize the options for the select lists vm.Courses = context.ReadAllCourses().ToList(); vm.LearnOutcomes = context.ReadAllOutcomes().ToList(); //TODO: Fix the value cannot be null problem if (!ModelState.IsValid) { return(View("Add", vm)); } QuesAnswer Qa = new QuesAnswer { Question = vm.Question, Answer = vm.Answer, Course = context.ReadCourse(vm.CourseId), LearnOutcome = context.ReadOutcome(vm.LearnOutcomeId) }; context.createQuesetion(Qa); return(RedirectToAction("Index")); }