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")); } }