예제 #1
0
        public ActionResult Register(FormCollection frmController)
        {
            Course_DAL  course_DAL   = new Course_DAL();
            Student_DAL student_DAL  = new Student_DAL();
            int         id_course    = int.Parse(frmController["CourseName"]);
            string      student_name = frmController["txtStudentName"];

            Student_Ent student_Ent = new Student_Ent();

            student_Ent.StudentName = student_name;

            //Add Student to SQL
            if (!(student_DAL.Add(student_Ent)))
            {
                ViewBag.Courses = course_DAL.GetCourses();
                ViewBag.Message = "Có Lỗi Xảy Ra !";

                return(View());
            }

            int id_student = student_DAL.GetID_byName(student_name);

            if (!course_DAL.Add_Register(id_course, id_student))
            {
                ViewBag.Courses = course_DAL.GetCourses();
                ViewBag.Message = "Có Lỗi Xảy Ra !";

                return(View());
            }

            ViewBag.Courses = course_DAL.GetCourses();
            ViewBag.Message = "Successfully !";
            return(View());
        }
예제 #2
0
        public ActionResult Register()
        {
            Course_DAL course_DAL = new Course_DAL();

            ViewBag.Courses = course_DAL.GetCourses();

            return(View());
        }
예제 #3
0
        public ActionResult Course()
        {
            Course_DAL course_DAL = new Course_DAL();

            return(View(course_DAL.GetCourses()));
        }