コード例 #1
0
        public ActionResult ListStudentCourseRegistration()
        {
            try
            {
                if (Request.Cookies["AdminType"].Value.ToString() != null)
                {
                    StudentCourseRegistrationDbLayer studentCourseRegistrationDbLayer = new StudentCourseRegistrationDbLayer();
                    return(View(studentCourseRegistrationDbLayer.ListStudentCourseRegistration()));
                }

                else
                {
                    return(RedirectToAction("Login", "Admin"));
                }
            }
            catch
            {
                return(RedirectToAction("Login", "Admin"));
            }
        }
コード例 #2
0
        public ActionResult DeleteStudentCourseRegistration(string CourseCode, int RollNumber, string DegreeTitle, string Session)
        {
            try
            {
                if (Request.Cookies["AdminType"].Value.ToString() != null)
                {
                    StudentCourseRegistrationDbLayer studentCourseRegistrationDbLayer = new StudentCourseRegistrationDbLayer();
                    studentCourseRegistrationDbLayer.DeleteStudentCourseRegistration(CourseCode, RollNumber, DegreeTitle, Session);
                    return(RedirectToAction("ListStudentCourseRegistration"));
                }

                else
                {
                    return(RedirectToAction("Login", "Admin"));
                }
            }
            catch
            {
                return(RedirectToAction("Login", "Admin"));
            }
        }
コード例 #3
0
        public ActionResult StudentCourseRegister(FormCollection formCollection)
        {
            try
            {
                StudentCourseRegistration studentCourseRegistration = new StudentCourseRegistration();
                studentCourseRegistration.CourseCode   = formCollection["CourseCode"];
                studentCourseRegistration.RollNumber   = Convert.ToInt32(formCollection["RollNumber"]);
                studentCourseRegistration.DegreeTitle  = formCollection["DegreeTitle"];
                studentCourseRegistration.Session      = formCollection["Session"];
                studentCourseRegistration.RegisterType = formCollection["RegisterType"];

                StudentCourseRegistrationDbLayer studentCourseregistrationDbLayer = new StudentCourseRegistrationDbLayer();
                studentCourseregistrationDbLayer.RegisterCourse(studentCourseRegistration.CourseCode, studentCourseRegistration.RollNumber, studentCourseRegistration.DegreeTitle, studentCourseRegistration.Session, studentCourseRegistration.RegisterType);
                ViewBag.SuccessMessage = "Student Registered with Course Successfully!!";
                return(View());
            }
            catch
            {
                ViewBag.ErrorMessage = "Failed..!!<br/> Course Code or Student Data is Incorrect..!!";
                return(View());
            }
        }