public ActionResult Page04(int?id, Page04ViewData page04ViewData)
        {
            // If the user navigated to this page without a record number as parameter,
            // redirect him/her to a generic error page.
            // if (id == null)
            // TODO: Does HasValue work correctly? - Rob, 12/10/2014
            if (!id.HasValue)
            {
                return(this.RedirectToAction("Error"));
            }

            if (this.CurrentRegistrationState != RegistrationState.Available)
            {
                return(this.RedirectToAction(this.CurrentRegistrationState.ToString()));
            }

            try
            {
                this.SetBaseViewData(page04ViewData);
                this.UpdateModel(page04ViewData);

                page04ViewData.VolunteerFound =
                    this.Repository.GetVolunteerByIdAndName(
                        int.Parse(page04ViewData.VolunteerId),
                        page04ViewData.VolunteerFirstName,
                        page04ViewData.VolunteerLastName);

                if (page04ViewData.VolunteerFound == null)
                {
                    page04ViewData.NoVolunteersFound = true;
                    return(this.View(page04ViewData));
                }

                // Make sure the volunteer found is not already assigned to a team.
                if (page04ViewData.VolunteerFound.TeamID.HasValue)
                {
                    page04ViewData.VolunteerAlreadyTaken = true;
                    return(this.View(page04ViewData));
                }

                TournamentRegistration newRegistrationData = new TournamentRegistration
                {
                    VolunteerID = page04ViewData.VolunteerFound.VolunteerID
                };

                // TODO: Send an e-mail reporting database failure; could not find the record already added to the database.
                this.Repository.UpdateTournamentRegistration(id.Value, 4, newRegistrationData);

                return(this.RedirectToAction("Page05", new { id }));
            }
            catch (Exception exception)
            {
                ErrorSignal.FromCurrentContext().Raise(exception);
                return(this.RedirectToAction("Error"));
            }
        }
        public ActionResult Page04(int?id)
        {
            // If the user navigated to this page without a record number as parameter,
            // redirect him/her to a generic error page.
            // if (id == null)
            // TODO: Does HasValue work correctly? - Rob, 12/10/2014
            if (!id.HasValue)
            {
                return(this.RedirectToAction("Error"));
            }

            if (this.CurrentRegistrationState != RegistrationState.Available)
            {
                return(this.RedirectToAction(this.CurrentRegistrationState.ToString()));
            }

            Page04ViewData viewData = new Page04ViewData();

            this.SetBaseViewData(viewData);
            viewData.NoVolunteersFound = false;

            return(this.View(viewData));
        }