public ActionResult MapCourseAndSubject(MapCourseAndSubjectViewModel objMapCourseAndSubjectViewModel)
        {
            using (var dbTransaction = db.Database.BeginTransaction())
            {
                SubjectInCourse subjectInCourse = db.SubjectInCourses.Create();

                try
                {
                    if (ModelState.IsValid)
                    {
                        subjectInCourse.CourseId  = objMapCourseAndSubjectViewModel.CourseId;
                        subjectInCourse.SubjectId = objMapCourseAndSubjectViewModel.SubjectId;

                        db.SubjectInCourses.Add(subjectInCourse);
                        db.SaveChanges();
                        dbTransaction.Commit();
                        return(RedirectToAction("Dashboard"));
                    }
                    return(View(objMapCourseAndSubjectViewModel));
                }
                catch (Exception ex)
                {
                    Console.WriteLine("Exception source: {0} user is failed to register", ex.Message);
                    dbTransaction.Rollback();
                }
            }
            return(RedirectToAction("Dashboard", "SuperAdmin"));
        }
        public ActionResult MapCourseAndSubject()
        {
            MapCourseAndSubjectViewModel objMapCourseAndSubjectViewModel = new MapCourseAndSubjectViewModel();

            var subjectsList = db.Subjects.ToList();

            objMapCourseAndSubjectViewModel.SubjectList = subjectsList;
            var coursesList = db.Courses.ToList();

            objMapCourseAndSubjectViewModel.CourseList = coursesList;

            return(View(objMapCourseAndSubjectViewModel));
        }