public ActionResult RegisteredStudent(Regestration studentRegestration)
        {
            if (ModelState.IsValid)
            {
                CardDAO Card_DAO = new CardDAO();
                if (Card_DAO.ISExsistCardDate(studentRegestration.CardNumber))
                {
                    RegestrationDAO Registrator = new RegestrationDAO();
                    if (Registrator.IsCardUnsoldAndUnRegisteredWhileRegitered(studentRegestration.CardNumber))
                    {
                        Registrator.RegisterStudent(studentRegestration);
                        return View(studentRegestration);

                    }
                    else
                    {
                        ModelState.AddModelError("", "The Card is already sold or the card number is invalid.");
                        return View("RegisterStudent");
                    }

                }
                else
                {
                    ModelState.AddModelError("", "There is no card with this card number.Please give a valid card number");
                    return View("RegisterStudent");
                }

            }
            else
            {
                ModelState.AddModelError("", "It seems it's lacking required information");
                return View("RegisterStudent");
            }
        }
示例#2
0
 public void RegisterStudent(Regestration studentRegistration)
 {
     studentRegistration.StudentId = GetStudentIdAfterInsertStudentInfo(studentRegistration);
     UpdateCardsTableWithStudentId(studentRegistration.CardNumber, studentRegistration.StudentId);
 }
 public void RegisterStudent(Regestration studentRegistration)
 {
     studentRegistration.StudentId= GetStudentIdAfterInsertStudentInfo(studentRegistration);
     UpdateCardsTableWithStudentId(studentRegistration.CardNumber, studentRegistration.StudentId);
 }