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")); }
public ActionResult Create() { Teacher_DAL teacher_DAL = new Teacher_DAL(); ViewBag.Teachers = teacher_DAL.GetTeachers(); return(View()); }
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))); }
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")); }
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")); }
public ActionResult Teacher() { Teacher_DAL teacher_DAL = new Teacher_DAL(); return(View(teacher_DAL.GetTeachers())); }