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 */ }
public ActionResult AssignTeacher() { CourseAssignManager aCourseAssignManager = new CourseAssignManager(); ViewBag.Departments = aCourseAssignManager.GetAllDepartments(); ViewBag.Teachers = aCourseAssignManager.GetAllTeachers(); ViewBag.CourseCodeList = aCourseAssignManager.GetAllCourseCodes(); return(View()); }
public ActionResult EditAssignedTeacher(int id, int?message) { if (message != null) { if (message == 0) { ViewBag.Message = "Sorry! Course Assign Update Failed !!"; } else if (message == 5) { ViewBag.Message = "Sorry! Course Code Exists !!"; } else if (message == 6) { ViewBag.Message = "Sorry! Course Name Exists !!"; } } CourseAssignManager aCourseAssignManager = new CourseAssignManager(); ViewBag.Departments = aCourseAssignManager.GetAllDepartments(); ViewBag.Teachers = aCourseAssignManager.GetAllTeachers(); ViewBag.CourseCodeList = aCourseAssignManager.GetAllCourseCodes(); CourseAssignToTeacherModel aCourseAssignToTeacherModel = new CourseAssignToTeacherModel(); aCourseAssignToTeacherModel = aCourseAssignManager.GetAssignedCourseToTeacherModelById(id); /*ViewBag.Departments = aCourseAssignManager.GetAllDepartments(); * ViewBag.Teachers = aCourseAssignManager.GetAllTeachers(); * ViewBag.CourseCodeList = aCourseAssignManager.GetAllCourseCodes();*/ return(View(aCourseAssignToTeacherModel)); }