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()); }
public ActionResult Delete_Accept(int id) { Student_DAL student_DAL = new Student_DAL(); if (!(student_DAL.Delete(id))) { ViewBag.Message = "Có Lỗi Xảy Ra !"; return(View("Delete", id)); } return(RedirectToAction("Student", "Student")); }
public DataTable Load() { try { return(sdobj.Load()); } catch { throw; } finally { sdobj = null; } }
public int Delete(int Sno) { try { return(sdobj.delete(Sno)); } catch { throw; } finally { sdobj = null; } }
public int Update(int sno, string firstname, string lastname, int age) { try { return(sdobj.update(sno, firstname, lastname, age)); } catch { throw; } finally { sdobj = null; } }
public ActionResult Edit(Student_Ent stu_ent) { if (ModelState.IsValid) { Student_DAL student_DAL = new Student_DAL(); if (!(student_DAL.Edit(stu_ent))) { ViewBag.Message = "Có Lỗi Xảy Ra !"; return(View()); } } return(RedirectToAction("Student", "Student")); }
public ActionResult Create(Student_Ent stu_ent) { Student_DAL student_DAL = new Student_DAL(); if (!(student_DAL.Check_Exist(stu_ent.StudentID))) { ViewBag.Message = "ID Tồn Tại !"; return(View()); } if (!(student_DAL.Add(stu_ent))) { ViewBag.Message = "Có Lỗi Xảy Ra !"; return(View()); } return(RedirectToAction("Student", "Student")); }
public ActionResult Delete(int id) { Student_DAL student_DAL = new Student_DAL(); return(View(student_DAL.GetStudent_Ent(id))); }
public ActionResult Student() { Student_DAL student_DAL = new Student_DAL(); return(View(student_DAL.GetStudents())); }
public Student_BAL(Student_DAL dalObj) { this.dalObj = dalObj; }