Ejemplo n.º 1
0
        public IActionResult Add()
        {
            var vm = new AddQuesAnswerViewModel();

            // Get the list of courses for the dropdown
            vm.Courses       = context.ReadAllCourses().ToList();
            vm.LearnOutcomes = context.ReadAllOutcomes().ToList();

            return(View(vm));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// IAction method for creating the displays for students outcomes and answers along with detailing a course
        /// </summary>
        /// <param name="id">Id for a course</param>
        /// <returns></returns>
        public IActionResult Details(int id)
        {
            var listAllStudents    = context.ReadAllStudents().ToList();
            var listAllOutcomes    = context.ReadAllOutcomes().ToList();
            var listAllQuesAnswers = context.ReadAllQuesAnswers().ToList();

            var listStudents      = new List <Student>();
            var listLearnOutcomes = new List <LearnOutcome>();
            var listQuesAnswers   = new List <QuesAnswer>();

            var studentsInCourse = new List <Student>();

            foreach (var item in context.ReadCourse(id).StudentCourses)
            {
                studentsInCourse.Add(item.Student);
            }

            foreach (var student in listAllStudents)
            {
                if (!studentsInCourse.Contains(student))
                {
                    listStudents.Add(student);
                }
            }

            var learnOutcomeForCourse = new List <LearnOutcome>();

            foreach (var item in context.ReadCourse(id).LearnOutcomes)
            {
                learnOutcomeForCourse.Add(item);
            }

            foreach (var lo in listAllOutcomes)
            {
                if (!learnOutcomeForCourse.Contains(lo))
                {
                    listLearnOutcomes.Add(lo);
                }
            }

            var quesAnswerForCourse = new List <QuesAnswer>();

            foreach (var item in context.ReadCourse(id).QuesAnswers)
            {
                quesAnswerForCourse.Add(item);
            }

            foreach (var qa in listAllQuesAnswers)
            {
                if (!quesAnswerForCourse.Contains(qa))
                {
                    listQuesAnswers.Add(qa);
                }
            }

            ViewBag.Students         = listStudents;
            ViewBag.LearningOutcomes = listLearnOutcomes;
            ViewBag.QuesAnswers      = listQuesAnswers;

            var course = context.ReadCourse(id);

            if (course == null)
            {
                return(RedirectToAction("Index"));
            }
            return(View(course));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// IAction method for returning a learningOutcome index view
        /// </summary>
        /// <returns></returns>
        public IActionResult Index()
        {
            var model = context.ReadAllOutcomes();

            return(View(model));
        }