public ActionResult StudentList() { var dal = new DAL.StudentDAL(); var stud = dal.StudentList(); return(View(stud)); }
public ActionResult Login(Models.Login model) { if (ModelState.IsValid) { var daluser = new DAL.UserDAL(); var user = daluser.Login(model); if (user != null) { Session["USER"] = user; var sestud = (Entity.User)Session["USER"]; int id = sestud.User_id; var dalstud = new DAL.StudentDAL(); var stud = dalstud.Searchstud(id); if (stud != null) { Session["Stud"] = stud; } var dalteac = new DAL.TeacherDAL(); var teacher = dalteac.Searchteac(id); if (teacher != null) { Session["Teacher"] = teacher; } return(RedirectToAction("Index", "User")); } else { Response.Write("<script> alert('ไม่พบผู้ใช้')</script>"); } } return(View(model)); }
public ActionResult Edit(DAL.StudentDAL std) { if (ModelState.IsValid) { Student = bll.getByID(std.ID); DAL.StudentDAL nameAlreadyExists = new DAL.StudentDAL(); nameAlreadyExists = bll.getAll().Where(s => s.fname == std.fname).FirstOrDefault(); if (std != null) { if ((nameAlreadyExists != null) && (Student.ID != nameAlreadyExists.ID)) { ModelState.AddModelError("fname", "Student Name Already Exists."); } else { bll.Edit(std); } } else { if (nameAlreadyExists != null) { ModelState.AddModelError("fname", "Student Name Already Exists."); } else { bll.Add(Student); } } return(RedirectToAction("Index")); } return(View(std)); }
public ActionResult Create(Entity.ProfileStudent model) { var user = (Entity.User)Session["user"]; var id = user.User_id; if (ModelState.IsValid) { var dal = new DAL.StudentDAL(); var chk = dal.Chkstud(model); if (chk != null) { Response.Write("<script> alert('รหัสนักศึกษานี้ถูกลงทะเบียนเเล้ว')</script>"); } else { var result = dal.Create(model, id); if (result) { Response.Write("<script> alert('ลงทะเบียนสำเร็จ')</script>"); } return(RedirectToAction("index", "User")); } return(View()); } return(View(model)); }
public ActionResult Details(string id) { var dal = new DAL.StudentDAL(); var Stud = dal.Search(id); return(View(Stud)); }
public ActionResult EditStud(Entity.ProfileStudent model, string id) { try { var dal = new DAL.StudentDAL(); var stud = dal.Search(id); stud.Stud_id = model.Stud_id; stud.Pre_Name = model.Pre_Name; stud.FristName = model.FristName; stud.LastName = model.LastName; stud.Group_id = model.Group_id; stud.Branch = model.Branch; stud.Faculty = model.Faculty; var result = dal.EditeStud(stud); if (result) { Response.Write("<script> alert('แก้ไข้ข้อมูลสำเร็จ')</script>"); } return(RedirectToAction("StudentList")); } catch (Exception) { Response.Write("<scrip> aler('ไม่สำเร็จ')</scrip>"); } return(View(model)); }
static BaseBLL() { admins = DAL.DataFileAccess.GetAdmins(); students = DAL.DataFileAccess.GetStudents(); teachers = DAL.DataFileAccess.GetTeachers(); courses = DAL.DataFileAccess.GetCourses(); termCourses = DAL.DataFileAccess.GetTermCourses(); }
public ActionResult Edit(int?ID) { if (ID != null) { int _id = (Int32)ID; Student = bll.getByID(_id); } return(View(Student)); }
public ActionResult StudHistory() { var model = (Entity.ProfileStudent)Session["Stud"]; string id = model.Stud_id; var dal = new DAL.StudentDAL(); var stud = dal.Search(id); return(View(stud)); }
public ActionResult Edit(string id) { using (var db = new Entity.Entities()) { ViewBag.PreName = db.PreName.ToList(); } var dal = new DAL.StudentDAL(); var stud = dal.Search(id); return(View(stud)); }
public ActionResult Delete(string id) { var dal = new DAL.StudentDAL(); var stud = dal.Search(id); var result = dal.Delete(stud); if (result) { Response.Write("<script> alert('ลบข้อมูลเรียบร้อย')</script>"); } return(RedirectToAction("StudentList")); }
public ActionResult Delete(int ID) { Student = bll.getByID(ID); return(View(Student)); }
public ActionResult Delete(DAL.StudentDAL std) { bll.Delete(std.ID); return(RedirectToAction("Index")); }