コード例 #1
0
        public ActionResult AssignTeacher(CourseAssignToTeacherModel courseAssignToTeacherModel)
        {
            CourseAssignManager aCourseAssignManager = new CourseAssignManager();

            ViewBag.Departments    = aCourseAssignManager.GetAllDepartments();
            ViewBag.Teachers       = aCourseAssignManager.GetAllTeachers();
            ViewBag.CourseCodeList = aCourseAssignManager.GetAllCourseCodes();
            //do the code to store in the database
            if (aCourseAssignManager.IsCourseExist(courseAssignToTeacherModel.CourseId))
            {
                ViewBag.Message = ("Course is already assigned");
            }
            else
            {
                int stored = aCourseAssignManager.SaveCourseAssignToTeacher(courseAssignToTeacherModel);
                if (stored == 1)
                {
                    ViewBag.Message = ("Course Assign to Teacher done successfully");
                }
                else
                {
                    ViewBag.Message = ("Course Assign to Teacher Error");
                }
            }

            return(View());

            /*
             * 1. one course should be assigned to one teacher only-done
             * 2. if teacher credit exceed, an dialog box with yes/no pop up and work accordingly
             * 3. remaining credit returning false count--done
             */
        }