public ActionResult RegisterCourse(string btnRegister, string CSelected, RegisterCourseVM rvm) { List <CoursesEnrolled> CEnrolledList = null; bool res = false; rvm.CList = BusinessLayer.BusinessStudent.GetCourses(); rvm.semList = BusinessLayer.BusinessStudent.GetSemesters(); string studentId = SessionFacade.LOGGEDIN; if (studentId == null) { return(RedirectToAction("Login", "Auth")); } rvm.course = BusinessLayer.BusinessStudent.dispCourse(rvm.CSelected); int StudID = int.Parse(studentId); if (CSelected != null && studentId != null) { CEnrolledList = BusinessLayer.BusinessStudent.dispCourse(CSelected); } if (btnRegister != null) { if (btnRegister.ToUpper() == "SUBMIT") { try { res = BusinessLayer.BusinessStudent.RegisterCourse(StudID, rvm.semselected, rvm.CSelected); } catch (Exception e) { ViewBag.Exmsg = e.Message; } if (res == true) { ViewBag.msg = "Course Registered....."; } else { ViewBag.msg = "Problem registering course....."; } } } //List<CoursesEnrolled> CEnrolledList = null; //string studentId = SessionFacade.LOGGEDIN; return(PartialView("_RegisterCourse", CEnrolledList)); }
public ActionResult UnRegisterCourse() { RegisterCourseVM rvm = new RegisterCourseVM(); rvm.CList = BusinessLayer.BusinessStudent.GetCourses(); rvm.CSelected = rvm.CList[0].Value; string studentId = SessionFacade.LOGGEDIN; if (studentId == null) { return(RedirectToAction("Login", "Auth")); } rvm.course = BusinessLayer.BusinessStudent.dispCourse(rvm.CSelected); return(View(rvm)); }
public ActionResult unRegisterCourse(RegisterCourseVM rvm, string btnSubmit, string CSelected) { bool res = false; rvm.CList = BusinessLayer.BusinessStudent.GetCourses(); string studentId = SessionFacade.LOGGEDIN; if (studentId == null) { return(RedirectToAction("Login", "Auth")); } rvm.course = BusinessLayer.BusinessStudent.dispCourse(rvm.CSelected); int StudID = int.Parse(studentId); if (btnSubmit != null) { if (btnSubmit.ToUpper() == "SUBMIT") { try { res = BusinessLayer.BusinessStudent.UnregisterCourse(StudID, rvm.CSelected); } catch (Exception e) { ViewBag.Exmsg = e.Message; } if (res == true) { ViewBag.msg = "Course has been un-registered....."; } else { ViewBag.msg = "Problem un-registering course....."; } } } return(PartialView("_RegisterCourse", rvm.course)); }