Ejemplo n.º 1
0
        public ActionResult Create(Course_Ent course_Ent, string TeacherName)
        {
            Course_DAL course_DAL = new Course_DAL();

            //Teacher_DAL teacher_DAL = new Teacher_DAL();

            if (!course_DAL.Check_Exist(course_Ent.CourseID))
            {
                Teacher_DAL teacher_DAL = new Teacher_DAL();
                ViewBag.Teachers = teacher_DAL.GetTeachers();
                ViewBag.Message  = "ID Tồn Tại !";
                return(View());
            }

            Teacher_Ent teacher = new Teacher_Ent();

            teacher.TeacherID = int.Parse(TeacherName);
            //teacher.TeacherName = teacher_DAL.GetName(teacher.TeacherID);

            course_Ent.Teacher = teacher;

            if (!(course_DAL.Add_Course(course_Ent)))
            {
                Teacher_DAL teacher_DAL = new Teacher_DAL();
                ViewBag.Teachers = teacher_DAL.GetTeachers();
                ViewBag.Message  = "Có Lỗi Xảy Ra !";
                return(View());
            }

            return(RedirectToAction("Course", "Course"));
        }
Ejemplo n.º 2
0
        public ActionResult Create()
        {
            Teacher_DAL teacher_DAL = new Teacher_DAL();

            ViewBag.Teachers = teacher_DAL.GetTeachers();

            return(View());
        }
Ejemplo n.º 3
0
        public ActionResult Delete(int id)
        {
            Teacher_DAL teacher_DAL = new Teacher_DAL();

            ViewBag.Teachers = teacher_DAL.GetTeachers();

            Course_DAL course_DAL = new Course_DAL();

            return(View(course_DAL.GetCourse_Ent(id)));
        }
Ejemplo n.º 4
0
        public ActionResult Delete_Accept(int id)
        {
            Teacher_DAL teacher_DAL = new Teacher_DAL();

            if (!(teacher_DAL.Delete(id)))
            {
                ViewBag.Message = "Có Lỗi Xảy Ra !";
                return(View("Delete", id));
            }

            return(RedirectToAction("Teacher", "Teacher"));
        }
Ejemplo n.º 5
0
        public ActionResult Edit(Teacher_Ent teacher_Ent)
        {
            if (ModelState.IsValid)
            {
                Teacher_DAL teacher_DAL = new Teacher_DAL();

                if (!(teacher_DAL.Edit(teacher_Ent)))
                {
                    ViewBag.Message = "Có Lỗi Xảy Ra !";
                    return(View());
                }
            }

            return(RedirectToAction("Teacher", "Teacher"));
        }
Ejemplo n.º 6
0
        public ActionResult Delete_Accept(int id)
        {
            Course_DAL course_DAL = new Course_DAL();

            if (!course_DAL.Delete(id))
            {
                Teacher_DAL teacher_DAL = new Teacher_DAL();

                ViewBag.Teachers = teacher_DAL.GetTeachers();
                ViewBag.Message  = "Có Lỗi Xảy Ra !";

                return(View(course_DAL.GetCourse_Ent(id)));
            }

            return(RedirectToAction("Course", "Course"));
        }
Ejemplo n.º 7
0
        public ActionResult Create(Teacher_Ent teacher_Ent)
        {
            if (ModelState.IsValid)
            {
                Teacher_DAL teacher_DAL = new Teacher_DAL();

                if (!(teacher_DAL.Check_Exist(teacher_Ent.TeacherID)))
                {
                    ViewBag.Message = "ID Tồn Tại !";
                    return(View());
                }

                if (!(teacher_DAL.Add(teacher_Ent)))
                {
                    ViewBag.Message = "Có Lỗi Xảy Ra !";
                    return(View());
                }
            }

            return(RedirectToAction("Teacher", "Teacher"));
        }
Ejemplo n.º 8
0
        public ActionResult Edit(Course_Ent course_Ent, string TeacherName)
        {
            Course_DAL course_DAL = new Course_DAL();
            //Teacher_DAL teacher_DAL = new Teacher_DAL();

            Teacher_Ent teacher = new Teacher_Ent();

            teacher.TeacherID = int.Parse(TeacherName);
            //teacher.TeacherName = teacher_DAL.GetName(teacher.TeacherID);

            course_Ent.Teacher = teacher;

            if (!(course_DAL.Edit(course_Ent)))
            {
                Teacher_DAL teacher_DAL = new Teacher_DAL();
                ViewBag.Teachers = teacher_DAL.GetTeachers();
                ViewBag.Message  = "Có Lỗi Xảy Ra !";
                return(View());
            }

            return(RedirectToAction("Course", "Course"));
        }
Ejemplo n.º 9
0
        public ActionResult Detail(int id)
        {
            Teacher_DAL teacher_DAL = new Teacher_DAL();

            return(View(teacher_DAL.GetTeacher_Ent(id)));
        }
Ejemplo n.º 10
0
        public ActionResult Teacher()
        {
            Teacher_DAL teacher_DAL = new Teacher_DAL();

            return(View(teacher_DAL.GetTeachers()));
        }