Ejemplo n.º 1
0
        public ActionResult SubmitCode(StudentSignUpModel m)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    StudentCode c = new StudentCode();
                    c.Code=m.code;
                    if (!c.IsValid())
                    { throw new Exception("Invalid Code."); }

                    //enable below code to disallow returning logins.
                    //if (c.IsClaimed())
                    //{ throw new Exception("This code has already been used to sign up."); }

                    Musical cm = Musical.CurrentMusical();

                    if (DateTime.Today.Date > cm.signupEndDate)
                    {
                        throw new Exception(cm.expiredMessage);
                    }

                    if (DateTime.Today.Date < cm.signupStartDate)
                    {
                        throw new Exception("The sign up period has not yet started. Please check back on " + ((DateTime)cm.signupStartDate).ToString("MM/dd/yyyy") + ".");
                    }

                    return RedirectToRoute("StudentInfo", new { code = c.Code });
                }
                else
                {
                    return View("SignUp", m.code);
                }
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("", ex.Message);
                return View("SignUp", m);
            }
        }
Ejemplo n.º 2
0
        //
        // GET: /Student/
        public ActionResult SignUp()
        {
            StudentSignUpModel m = new StudentSignUpModel();

            return View(m);
        }