public ActionResult AddCard(int id) { if (id == 0) { return new HttpStatusCodeResult(HttpStatusCode.BadRequest); } if (ModelState.IsValid) { StudentDAO Student_DAO = new StudentDAO(); Session["StudentId"] = id; return View(); } else { ModelState.AddModelError("", "Sorry Student information is not found."); return View(); } }
public ActionResult Edit(int id) { if (id == 0) { return new HttpStatusCodeResult(HttpStatusCode.BadRequest); } if (ModelState.IsValid) { StudentDAO Student_DAO = new StudentDAO(); return View(Student_DAO.GetStudenInfoForEditing(id)); } else { ModelState.AddModelError("", "Sorry Student information is not found."); return View("SearchStudent"); } }
public ActionResult ViewStudent(SearchStudent searchStudent) { if (ModelState.IsValid) { CardDAO Card_DAO = new CardDAO(); if (Card_DAO.ISExsistCardDate(searchStudent.CardNumber)) { RegestrationDAO Registrator = new RegestrationDAO(); if (Registrator.IsValidCardInDataBase(searchStudent.CardNumber)) { StudentDAO Student_DAO = new StudentDAO(); return View(Student_DAO.GetStudenInfo(searchStudent.CardNumber)); } else { ModelState.AddModelError("", "The Card Number is not sold yet,so there is no student registerd with this card number"); return View("SearchStudent"); } } else { ModelState.AddModelError("", "There is no card with this card number.Please give a valid card number"); return View("SearchStudent"); } } else { ModelState.AddModelError("", "The Card Number is invalid"); return View("SearchStudent"); } }
public ActionResult Edited(Student student) { if (ModelState.IsValid) { StudentDAO Student_DAO = new StudentDAO(); Student_DAO.UpdateStudentInfoWithStudentId(student); return View(Student_DAO.GetStudenInfoForEditing(student.StudentId)); } else { return View("Edit"); } }